Adding Person or Group data to List Instance in CAML

October 26, 2012 Leave a comment

Here’s a quick gem from the comments on MSDN for Field Element (List -Definition).

…to set the value of a “Person or Group” field if the ID of the user is not known, …use the value “-1;#<domain>\<username>”.

This is useful in the scenario that you want to pre-populate a List Instance with data for a ‘Person or Group’ field (Type=”User” in CAML). 

The numeric component of the field’s value is the ID of the user within the UserInfo list within SharePoint and this value will change for the same user in different environments (for example development, test and production).  By setting this to ‘-1’, SharePoint will resolve the specified fully qualified domain name of the user against the UserInfo list for the current environment.

Thanks to Rudolph de Wet for the advice.


Central Administration Navigation in 2010

Working on a migration project has given me apple opportunity to use the revised Central Administration web site provided by SharePoint 2010. Unfortunately I’d have to conclude that in some respects it represents a retrograde step, especially in terms the usability of the site navigation.

The problem is that the navigation is not always updated based upon the context of the page you are viewing, in many cases leaving you with no option but to return to the home page and navigate through several pages to get back to your original context.

This is perhaps best illustrated with one of the more commonly used Service Applications, the User Profile Service Application. Here we are, happily browsing the User Profile Service Application:

User Profile Service Application

Clicking on the Manage User Profiles link takes us to the Manage User Profiles page:

Manage User Profiles

So far, so good you might say.

However, should you wish to return to the User Profile Service Application page you can’t using the navigation provided by the Central Administation site. The site breadcrumbs offer only one choice, to return to the Central Administration home page, and the Quick Launch links are entirely static. This is very frustrating.

I thought I had a cunning workaround for this issue; after all Central Administration is a SharePoint Foundation site and we can edit the Quick Launch ourselves to add-in commonly used links as we would any other site?

Central Admin Quick Launch

Unfortunately, this isn’t the case and no matter what you add to the Central Administration’s Quick Launch navigation configuration none of the links are ever displayed in the Quick Launch navigation bar.

So for now I’m reduced to using browser bookmarks to navigate between Service Applications.

Interestingly this isn’t the case for the administration of Timer Jobs which provides a context-based menu located above the main Quick Launch navigation:

Manage Timer Jobs

I don’t know why this wasn’t implemented for other areas of the Central Administration site. If it had been, it would make the site a lot easier to use.

MOSS Search Issues related to User Profile for Service Account

Hopefully this may prove a sanity saver for anyone else who encounters this issue…

When executing a crawl from Search Administration, the crawl log shows the following error:

The protocol handler cannot be found. Check that the handler has been installed.

Within Event Viewer management console, the Application log had the following Warning:

The start address cannot be crawled.

Context: Application 'SharedServices', Catalog 'Portal_Content'

The protocol handler cannot be found. Check that the handler has been installed. (0x80040d1a)

This prevents any crawling of SharePoint content and no amount of starting and stopping the Office SharePoint Server Search service will fix the problem.

…and this Error:

The gatherer service cannot be initialized.

The Temp folder is on a drive that is full or is inaccessible. Free up space on the drive or verify that you have write permission on the Temp folder. (0x80070660)

On starting the Office SharePoint Server Search service, the same error was noted:

Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, and that your network is functioning correctly.

DETAIL - The system cannot find the file specified.

What happened was that the local User Profile of the service account identity used for the Office SharePoint Server Search had somehow become invalid.

A possible cause for invalid master page error

March 5, 2010 1 comment

Another one for to save my sanity… and yours hopefully.

If you are updating the master page URL through managed code then you might experience the issue where the master page is applied successfully but on the Site Master Page Setting page you encounter the following errors:

  • The site master page setting currently applied to this site is invalid. Please select a new master page and apply it
  • The system master page setting currently applied to this site is invalid. Please select a new master page and apply it

Invalid master page messages

When the page loads it attempts to match the currently applied master page with a value from the list of master pages in the Master Page Gallery in order to indicate the selected master page in the drop list:

List of available master pages

This match is case-sensitive therefore you must ensure that when the MasterUrl and CustomMasterUrl values are updated using the object model that you use the exact name for the master page as it appears in the Master Page Gallery.

Don’t include a plus (+) sign in filenames for files uploaded to SharePoint

February 15, 2010 Leave a comment

This one is for my own sanity as much as for anyone else’s benefit: don’t include a plus sign (+) in filenames for files uploaded to a SharePoint document library.

The + character is permitted in a filename within Windows, and SharePoint will permit the file to be uploaded, however when the file is accessed the + is not escaped within the URL and an HTTP 404: File Not Found will be displayed.

Further to this, Tim Jones provides an excellent solution (and discussion leading up to his solution) on how to strip invalid characters from files when uploading to SharePoint.

Custom Master Page and My Sites

December 11, 2009 Leave a comment

My Sites are often branded with a custom master page, using feature stapling to apply the customisations. The SharePoint Team Blog contains a good description of how to do this.

However, there is a gotcha with updating the MasterUrl and CustomMasterUrl properties of the My Site. The default value for these properties gives the full path to the master page catalogue and default.master page: /personal/user/_catalogs/masterpage/default.master

Therefore rather than replace the entire path when setting the master page simply replace the string “default.master” with your chosen custom master page:

var masterPageUrl = web.MasterUrl.ToLower();
masterPageUrl = masterPageUrl.Replace("default.master", "mycustom.master");
web.MasterUrl = masterPageUrl; 

Add Web Server role before installing SharePoint

September 21, 2009 1 comment

The Web Server role should be added to the server prior to installing SharePoint otherwise slipstreamed updates are not deployed correctly on Windows 2008 R2.


Having followed the instructions listed on TechNet for a Windows 2008 deployment using a slipstreamed installation source, the following error was encountered when attempting to create a Publishing site collection:

The Office SharePoint Server Standard Web application features feature must be activated at the web application level before this feature can be activated.

Looking at the version number reported by Central Administration and that shown for Microsoft.SharePoint.Portal.dll it was clear that the SP2 update had not been correctly applied; the dll was reporting the original version number whereas Central Administration reported the correct version number for SP2.

This was confirmed when running the stand-alone SP2 update packages; the update package for WSS 3.0 claimed that the update had already been applied but the Office SharePoint Server update package did not detect that SP2 had already been applied. Re-applying the SP2 update for Office SharePoint Server fixed the problem quoted above.

To prevent this from happening in the first place, add the Web Server role before installing SharePoint and the updates will be applied correctly.

For more information refer to the answer given in this TechNet post: Error trying to activate Publishing Infrastructure