Thursday, September 30, 2010

SharePoint Server 2010 Search Folder Permissions

After initial configuration of SharePoint Server 2010 search, queries to indexed content failed with error Internal server error exception…Correlation ID.

It was discovered through ULS trace logs that the Search Service account could not access the windows TEMP directory. To resolve, environment variable for the Windows TEMP directory was switched to D:\TEMP and the search service account was given modify permissions to this folder.

SharePoint 2010 Userprofile Import and NetBIOS

If your NetBIOS and domain names are different, Replicate Directory Changes permission for your user profile synchronization service account is also needed on the cn=configuration container (google it if your not sure where to change). In environments where both items are same, this permission is only required at the Domain level.

Also, before importing user profiles, NetBIOS domain names have to be enabled on the User Profile service application.

To "enable" NetBIOS domain names once a connection is created requires the connection to be deleted and a new connection created with the flag turned on (set to 1 or true).

How To: Enable import of NetBIOS Domain Names:

Using the 2010 SharePoint Management Shell, enter following commands:


Get-SPServiceApplication (lists the Service Applications and their GUIDs)
$UPA = Get-SPServiceApplication –Id <GUID of User Profile Service Application>
$UPA.NetBIOSDomainNamesEnabled=1
$UPA.Update()


See more information regarding this issue at http://social.msdn.microsoft.com/Forums/en-US/sharepoint2010general/thread/398f3553-5de7-456b-b935-4e22cee26b2f

Quick Switch to Edit Mode in SPS 2010

Problem: No easy way to switch to Edit Mode to add a web part.  Current Steps of going to Site Actions and Selecting Edit Page to get to edit mode where you can then click 'Add a Web Part' is not intuitive.

Solution: We can at least make it easier to switch to edit mode by throwing a button on the page only visible to Site Owners.  There is a standard JavaScript function (ChangeLayoutMode()) which can be associated to button.

image

Achieved this result via a minimal code method as follows:

  • Using SharePoint JavaScript functions to make this work (you can discover other JavaScript functions available by viewing source on the SharePoint page).
  • Added below source HTML with minimal styling to file called editModeWP.txt and uploaded file to a document library on my SharePoint site. 
  • HTML source:

<style type=text/css>
input.xyzBlue {background-color: #51b5e0; font-weight: bold; font-size: 12px; color: white;}
</style>
<input class="xyzBlue" type=BUTTON value="Switch to Edit Mode" name="wpMode" onClick="window.location = 'javascript:ChangeLayoutMode(false);';">

  • Added "Content Editor" web part to home page and set it's "Content Link" to the location of the txt file saved above.  Set "Chrome Type" to none.  Set "Target Audience" to "Owners" (owners should be the only ones that see this on page, if all users see it, it will be useless to them when they click because they don't have correct permissions to edit).

Enhancements:

  • I approached this using minimal development path, however, if this is something you want consistent throughout you environments, it will require adding the updated code to many of your page layouts.  You could also add logic to this current method switch the button name and onclick event to the JavaScript which stops editing the page.

My Site Branding in SharePoint 2010

I found a nice post on branding My Sites in SharePoint Server 2010 here.  I took it next step and have provided the source code for a feature staple to update the global navigation for branding your SPS 2010 My Sites.

This solution contains sample branding to be implemented to the My Sites host template and personal site template.   This branding is simply implemented for sample purposes and is not a full-fledge, tested, production-ready branded interface.


It was developed as a Feature Staple packaged in Visual Studio 2010.   The Global navigation utilized in the My Sites templates loads from a User Control which cannot be modified via master page updates in SharePoint Designer – thus the feature staple.

The feature staple solution for this customization was built with following components:

  • New user control (XYZMysiteNav.ascx).  This user control is copied from existing GlobalNavigation user control.  This new control adds reference to a new CSS file and three new <div> tags.  The new <div> tags are used to accept placement of the header consisting of three images.  New control deployed to web server folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\xyzmysites.
  • A new feature (XYZ.MySiteFeatureStaple_XYZ_MySiteBrand).  This feature binds the new user control to the existing user control and is deployed to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\XYZ.MySiteFeatureStaple_XYZ_MySiteBrand.
  • Custom CSS (xyz_mysites.css):  This CSS file contains updated styling for the new <div> tags and updates to positioning, colors, and fonts for existing SharePoint IDs and Classes.  This CSS is mapped to folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\1033\STYLES for deployment.
  • Custom images:  A variety of images used for header, logo, background, and webpart titles referred to in above CSS file.  The images are mapped to folder C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES\xyzpilot for deployment.
  • Feature Staple (XYZ.MySiteFeatureStaple_XYZ_MySiteStaple).  Feature staple is used to staple the feature mentioned above (XYZ.MySiteFeatureStaple_XYZ_MySiteBrand ) to the Personal Site (SPSPERS) and the My Sites Host (SPSMSITEHOST) site templates and is deployed to C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\XYZ.MySiteFeatureStaple_XYZ_MySiteStaple

The above solution is packaged into a SharePoint solution file (XYZ.MySiteFeatureStaple.wsp – grab from debug folder if you want to deploy to see what it does) and deployed to the web application hosting my sites where it is activated on the My Site Host site collection.

Through feature stapling, the feature is automatically enabled on new personal sites which are created but for all existing sites, the feature has to be activated by running the script below from the SharePoint PowerShell Command prompt on the WFE server (brandpersonal.ps1 powershell script can also be found at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\xyzmysites):


$personalSites = get-spsite | where {$_.RootWeb.WebTemplate -eq "SPSPERS"}

foreach ($site in $personalSites) {Enable-SPFeature -Identity "MyNewNavFeature" -Url $site.Url}



Download source code from this link.