Archive for June 2010

 
 

SPN = Service Principal Name

This is an issue we’ve looked at before, and may again, where services have to be properly identified in order to be shared across computers. For SharePoint, we installed Kerberos authentication which relies on Service Principal Names (SPNs). Here is a great description of how this works.

hth

-robot

MOSS 2007 BDC Effort

We’ve seen this work before so, you’d think…

But, so it goes with SharePoint sometimes.

I found this great piece from our new friend Tobias that helps with the Application Definition Designer. Everything goes according to plan until I get to the BDC Web Parts. We’ll cover all this, but, for now, what’s happening is that, in my Business Data Type Picker dialog box, I get: There are no Business Data Types loaded in the Catalog.

Of course, I can look at my BDC and see that’s not true. So I went looking and found Ulysses’ post here and followed along. When he gets to the SSO configuration in Central Admin, I get an error:

Single sign-on cannot be configured from this server. To configure single sign-on, go to the computer running the single sign-on service and specify these settings locally.

Obviously a complication that Ulysses had not anticipated so I went off looking again and found Robert’s MOSSSSOSSxS (I love my job! The last four = “Setup Step by Step”)

His steps are:

  1. Set up the service account; I’ll use my MOSS_DBAccess account.
  2. Create SSO Groups;
  3. Configure the SSO Service in the Windows Services MMC.
  4. Configure SQL Server Permissions.
  5. Configure SSO in Central Admin.
  6. Manage the Encryption Key; huh?
  7. Manage EAD setting; Enterprise Application Definitions.

So, it’s early yet; maybe we can make some progress.

-robot

SharePoint Foundation 2010 Web Parts – The Way Things Should Have Been

Have you ever uttered an obscenity when you tried to build a web part for SharePoint 2007? How about for SharePoint 2003? Wasn’t that just ridiculous? Well on first review, your vocabulary may be taking a turn for the better; This really is easy.

The one thing that hasn’t gotten any better is the propensity for the providers of “How-To” guides at Microsoft to booger things up while we struggle with these new concepts.

For example, anybody that can make heads or tails out of this ought to work for the Franklin Mint. As I read it, the file names vary from step to step and the code includes the fancy left and right side quotation marks that blow up your .cs pages. So I went looking for another one.

Then I found this one that was much better but still has at least one “gotcha.” It seems that the author neglected to properly modify his name space in his sample code and that will blow up your build. This gives us a good chance to try to figure our what his or her  problem is.

Recall that we’re running SharePoint Foundation on Windows 7 x64 VM, per our recent posts, and that we’ve installed VS2010 from the 90 day trial download version.

First, like I said, the create\build\deploy steps are a snap. In VS 2010, it’s File | New | Project and under the C# projects, select the SharePoint 2010 node, select the Visual Web Part and click OK. One thing to think about is where you put the solution. In Windows 7, if you put it in the C:\Sample Web Parts folder, you’ll have to do a silly Run As Administrator tap dance later to delete it. I chose to create and use a folder under my user name folder next to My Documents and check the Create directory for solution option. Then click OK.

Then, you get one of the cool new parts, it asks you for the site where you want to deploy\debug your web part. I created a blank sample site and used it. My Deploy as a Sandboxed Solution option was greyed out; not sure what to make of that. I just clicked Finish.

So my solution gets built and I’ve got a bunch of files and since I didn’t change the name in the previous step, in Solution Explorer, I’ve got a VisualWebPart1 node. I see it have a VisualWebPart1UserControl.ascx file under it which has a VisualWebPart1UserControl.ascx.cs file under it which has a VisualWebPart1UserControl.ascx.design file under it. Pretty Deep, no?.

Okay, on the .ascx file, right click and select View Design. The design page and the tool box open. In the toolbox, find the TreeView control under the Navigation section (Very Visio-like toolbox) and drag one onto the design. When the treeview control is selected in the design pane, its properties will show up in the properties pane at the bottom right of the VS workspace. Find the ID property and set it to siteStructure and then click Save. So far, so good.

Then we have to code the .cs page to populate the tree when the page loads. The guy\gal that wrote the post (here‘s another link to it)  just gives us the code with a convenient Copy Code link. Click the link. Back in your project, right click the .ascx.cs file and select view code. Click in the code somewhere and press CTRL-A | CTRL-V.

Notice the red squiggleys in two palces, both under the word siteStructure? Believe me, these guys get paid way more than me so they ought to know better.

Here’s the problem. The dude\dudette was obviously on his way back to Seattle back from Burning Man when he wrote this and he had Bonneville on his mind and wrote that into his namespace. Now I probably don’t understand namespaces as well as some of you, but I know:

BonnevilleTestBed.Bonneville <>VisualWebPartProject1.VisualWebPart1

The left side of that equation is the namespace cited in the .cs code we copied from the guy’s article. In addition, the code tries to build a partial class called:

BonnevilleUserControl

The left side of that equation is the namespace cited in the .cs code we copied from the guy’s article. If you right click on the .ascx.designer.cs page and select View Code, you’ll see that what we really need is a namespace called VisualWebPartProject1.VisualWebPart1 and a partial class named VisualWebpart1UserControl.

Copy those names from the .designer.cs page to the .ascx.cs page overwriting the silly Bonneville stuff. The red squiggleys go away. Press f5.

My Sample site comes up and sits there like it’s a SharePoint site which, of course it is, but it’s not doing anything. But, I can select Edit Page from the Site Actions menu and click Add a Web Part. In the Categories picker on the left, I select Custom and there’s my VisualWebPart1. I select it and the click Add and then click the Stop Editing button on the ribbon.

Since I used a blank site, there’s nothing under my Sample Site node but, as I add lists, libraries and subsites, they fall into my tree view just fine.

Now all we need to do it build a solution we can add to our SharePoint sites for real, not just in our debugger mode.

There’s a great expository on the process here written by our new best friend, Eric, at BinaryWave.com. He explains the advantages of the new process and an introduction to the steps we’ll take to deploy our new web part to a production farm.

Eric brings up a couple of great, new points, the first of which is conflict resolution. These are issues that arise when, for example, I deploy MyWebPart as a feature in a site where you’ve already deployed your MyWebPart. Conflict, Ouch! Let’s ignore this for now with a promise to explore these conflict resolution properties later.

Second, Eric tells us we’re really dealing with SPI’s (SharePoint Items.) These are the components that will be mashed into a solution for deployment. In our case we have one, VisualWebPart1. Eric tells us:

By default, all SPI’s in the project which are included in a Feature, along with any mapped folders, will be automatically added to the package.

That should work for us now since what we want is a package with our web part in it that we can add to our production environment. Where we’re headed is a file called package.package. See why I love this job? As we may already know, the steps are to bundle our SPI’s into a package, deploy the package as a solution on our target location and activate the features that bring our SPI’s to life while, at the same time, avoiding any conflict nastiness.

At this point Eric strays off into other objectives as we go looking for someone more on point, like our new best friend Belajar, here. He says right-click on our project name and select Package. I get a status bar indication that Package Succeeded and I get a VisualWebPartProject1.wsp in my project’s bin\debug folder.

So with the .wsp in hand, we need only to load it into our production portal. The best source for this info is our new best friend, ICC, who feeds us, here, the PowerShell routines that get this done for us.

I do the add-spsolution and that works fine.

Then, I try the install-spsolution and I get this silly error:

PS> install-spsolution -identity visualwebpartproject1.wsp -webapplication http://Jeffery -GACDeployment
Install-SPSolution : Admin SVC must be running in order to create deployment timer job.

That is where we go look at our Windows services and find the SharePoint 2010 Administration Service and start it. I recall setting it to Manual Start previously to conserve resources on the “Production” box. Then I have to go look in Central Administration to find the timer job that started but never ended. It’s in the list under Central Admin | Monitoring | Check job status. Now the status page is nice but with the way it pages, it’s kind of clumsy so I click on Job Definitions and found the VisualWebPartProject1 job and opened it and selected Delete. Then I went back to PowerShell and ran my install again. When it returns a PS prompt, I know something worked.

So I create a web part page to add my new web part to and it’s not there. Rats.

This leads me to the Web Part Gallery. It’s not there either.  More Rats.

Now this part is tricky. Notice, on the Web Part Gallery, up on the ribbon, you get a Library Tools set with a Documents and a Library option. Clicking on Documents we get a New Document option. Click it Baby!

 At the very bottom of the list, there’s our VisualWebProject1.VisualWebPart1.VisualWebPart1 web part. Drop an X in the box and click Populate Gallery back at the top of the page. That takes us back to the gallery with our new web part sitting there with a little SharePoint New flag next to it.

Go back to the web part page and click on the Add Web Part link. In the Miscellaneous group, we get the VisualWebPart1 option. Select it and click Add. Click the red X to stop editing and reload the page.

That has got to be the prettiest web part I have ever seen.

This is also where we’ll start our “Yay, It’s Friday” celebration. Have you seen Hoops and Yoyo’s “I Don’t Care Friday” routine?

-robot

Side Topics: Windows PIDs and SharePoint Code

While we’re getting ready for our first SharePoint 2010 project in Visual Studio 2010, I ran into a couple of rich resources that I hope you find interesting.

First, even robots need to know why their computer is running slow and it’s always stuff running that we’d prefer not run. You see these on your task manager where you see a  list of gobbledygook and a column for Memory. There’s always a couple of items taking tens or even hundreds of thousands of Kbs and it’s aways hard to figure out if it’s a good thing or a bad thing.

So, what this robot does is click on the Memory column header twice to sort descending. That brings the fat pigs to the top. Then I look at the Image Name for a given pig and see what it is. If I don’t recognize it, I look it up on Google. Google always returns a load of sites that want to sell me anti-malware garbage so I try to stick to bleeping-computer.com and a small number of others.

One thing I didn’t know was that you can add columns to the Process list using the Select Columns option on the View menu. Two of the columns I like are the PID and the Memory Delta (Working Set Delta). The former gives you a key to learning more and the latter gives you a real-time value of memory grabbed or released by the given process as it runs.

One probelm is, often, the image name is undecipherable such as svchost.exe or conhost.exe. This is where the PID comes in handy.

Our friends at www.howtogeek.com have clued us into converting the PID to an actual program. They told us to open a command prompt and run:

 >Tasklist .svc

This gives us a list of the processes and their PIDs but also any services supported by the process. This, too, can be gobbledygook but at least it’s gobbledygook you can look up on Google. For example, I have a svchost.ese running on PID 160 and it’s supporting by AudioEndpointBuilder service.

Whatever.

And, yet, I find this and this and it seems like that’s one service to which I might not mind allowing access to a bit of my precious 8Gb of RAM.

Repeat the process for all your images, PIDs and services and you’ve got a pretty good idea of what you might not want to run, like the IIS Admin Service on my Pentium 3 Windows ME box.

Then, I got to thinking that the command prompt is so last week, we really ought to have a sweet little PowerShell command to do the same but better, and, of course, we do but it’s a little more complicated than that. Out friends at monadsblog.blogspot.com outline it here.

Our second topic today is a nice little series by our new friend, Dan, who write for SharePointStories.com. He’s alot like us in that he’s stubborn enough to try to squeeze the maximum functionality out of OOTB SharePoint and then, consider custom code. His post from last week sets up a good look at this process regarding the use of dates in list views. Another recent post looks at customer service as a business process. both of these are topics we’ve covered here at SharePoint from Scratch. Take a look and let us know what you think.

Finally, we’re still planning on having our VS2010 SharePoint Project completed by the end of the week. Let’s see what the rest of the week brings us.

hth

-robot

Installing Visual Studio on Win7x64 VM w\SharePoint

Using the VMWare Player console, we were able to get SharePoint Foundation running on a Windows 7 x64 VM. So let’s add VisualStudio and get our development environment running.

I insert the VS 2010 Ultimate Edition DVD they gave away at the Launch Event last week. It autoruns and I click Install Microsoft Visual Studio 2010. There’s a wizard welcome screen. The license agreement page warns to exit all applications and tells me I’m going to need about 8Gb hard drive space. I was listening to Pandora so I quit that, click Accept and Next. I select a Full install.

The wizard runs through about two dozen components including .Net 4, Microsoft F# Runtime, the Silverlight SDK, SharePoint developer tools and a bunch of SQL Server stuff.

After the .Net 4 install, it wants to reboot. It configures on the way down and more setup on the way up. Then the wizard resumes where it left off.

The 11th item in the list is actually called Microsoft Visual Studio 2010 Ultimate. Once the little blue arrow gets to this guy, the green status bar at the bottom seems to stop. Yeah, this might take a few minutes, I suppose but this seems to be turning into trouble.

But no, after about 12 minutes, the green bar starts to move and we start getting directories and files listed at the bottom.

The last item is Visual Studio Help 1.0 x64 and it takes about a tenth of a second and Success.  The wizard suggests updates, Visual Studio Gallery tools and the Help Library Manager.

Since this is a 90 day trial on a 90 day OS, I’m going to pass on updates. The gallery is a user populated set of development tools I may look at later; if any of you have any favorites, I’d be glad to take a look. And, Help Schmelp, I’m clicking Finish.

I get one last look at the wizard that asks me do I want to Change or Remove VS2010 or check for serivce releases. I click Exit.

I click the start bubble and select Programs | VS 2010. The default environment settings selector comes up and I select Visual C# Development Settings and click Start Visual Studio.

Now if this is anything like the Lauch Event last week, we’re only about five clicks away from deploying our first web part.

That will follow later.

hth
-robot