Great C# Command Line Argument Parser

Something that should be built into .Net to begin with:

http://jake.ginnivan.net/c-sharp-argument-parser

Awesome SharePoint Webpart Exception handling

This is epic.  Check out this exception handling base class for SharePoint webparts: http://andreascode.blogspot.com/2007/12/general-exception-handling-in-web-parts.html.

No more wrapping try/catch blocks in every single webpart in your project.  I love it!

SharePoint PeoplePicker in a one-way trust scenario

I was having major issues getting the people picker to work in a one way trust scenario. Here is what helped me get it working:

1. Ensure that the AD trust is working correctly. This can be done in Active Directory Domains and Trust on the Domain Controller.

2. The Farm Account should be a member of the local machine’s administrator group.

3. On the “HKLM\Software\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure” registry key ensure the following permissions are in place and are being inherited in the sub-keys

* WSS_WPG Read permission
* WSS_Admin_WPG Full Control
* WSS_RESTRICTED_WPG_V4 Full Control

4. Get and copy the peoplepicker-searchadforests property value via stsadm command:
stsadm -o getproperty -url -pn peoplepicker-searchadforests

5. Clear the peoplepicker-searchadforests property value via stsadm command:
stsadm -o setproperty -url -pn peoplepicker-searchadforests -pv “”

6. Rerun the password encrypt command with different password:
stsadm -o setapppassword -password
NewPassword can be anything you want.

7. Set the peoplepicker-searchadforests property value via stsadm command:
stsadm -o setproperty -url -pn peoplepicker-searchadforests -pv

Credit for this list goes to http://www.agrypnia.com/blog/2010/12/22/sharepoint-2010-there-was-an-error-in-the-callback.html

SharePoint Page Layouts – extra markup added

Ran into an issue where a page layout that was being deployed as a feature was throwing an error when trying to create a new page: “Only Content controls are allowed directly in a content page that contains Content controls.” I looked at the layout in the solution file and it there was nothing but Content controls. However, when I went to the server I saw a bunch of extra markup added to the end of the file. Apparently, your content tags must have the word “Content” capitalized or SharePoint assumes it just a plain .aspx page. Thanks goes to the link below for providing the solution.

http://geekswithblogs.net/Mathoms/archive/2009/02/20/moss-solutions-and-features-in-deployments–part-3.aspx

How to: Find SharePoint’s Database server and instance

Here’s an easy way to get the server and instance name of the database server your SharePoint server is using. It’s very useful for constructing connection strings on the fly (hint, hint).


public string FindSPSQLServerName()
{
     String sServerName = "";
     SPWebService service = SPFarm.Local.Services.GetValue();

     SPDatabaseServiceInstance s = service.DefaultDatabaseInstance;
     sServerName = s.Server.DisplayName + "\" + s.Instance;
     return sServerName;
}

SharePoint 2010 Install Links

Here are some links that have been useful during the SharePoint 2010 installs that I’ve done so far:

I’ll add more as I come across them.

SharePoint 2010 Unmanaged Accounts

Take a look at this article: http://www.windowsitpro.com/article/sharepoint/Watch-Out-for-Unmanaged-Accounts.aspx

Apparently, MS didn’t make every account managed. I just ran into an issue today where the default content access account automatically reset it’s password and it didn’t get updated in the search service. As a result, all crawls started to fail.

SharePoint 2010 – Content Types and Site Columns in .wsp’s

Remember having to create features that deploy custom content types in MOSS 2007? How painful it was? How you just really didn’t want to do it?

In SharePoint 2010, it is super easy. Just see here.

SharePoint 2010 CSS – Dialog Boxes

Came across a good post here about dealing with dialog boxes when branding a SharePoint 2010 site: http://www.heatherwaterman.com/blog/Lists/Posts/Post.aspx?ID=21.

Adding .ms-dialog in front of some additional styles allowed me to remove my page background image and remove the fixed width in my container div.  Good deal.

Page Layouts, Solutions and SharePoint Designer (Updated)

If you are deploying custom page layouts using a feature, DO NOT OPEN THEM IN SHAREPOINT DESIGNER! Not even once. Not just to “take a look”. Not for giggles.

Why? Because once you open that page layout in SharePoint Designer, it gets un-ghosted. This does two things. First, it means that you have to make changes in SharePoint Designer. The .aspx file in the feature directory is no longer used when rendering pages based on that page layout. Second, if you’ve attached a code-behind to the page, you’ll get a error indicating that type is not registered as safe. This occurs because SharePoint uses a type-safe parser on all un-ghosted content.

If you’ve come accross this post because you already did open the page layout in SPD, have no fear. To remedy your error, simply go to Site Actions…Site Settings…Reset to Site Definition. Once you do that, re-deploy your feature containing the page layout. Now, your page layout is ghosted.

Update: Well, I ran into an issue where “Reset to Site Definition” just didn’t work. So, I tried the stsadm command here (with -force): http://stsadm.blogspot.com/2007/09/re-ghosting-pages.html and now we’re back to un-ghosted. Very frustrating.

Switch to our mobile site