Sunday, May 01, 2011

Access to the path 'C:\Program Files\Common Files\Microsoft Shared\Program Files\Common Files\Microsoft Shared\Web Server Extensions\\14\template\layouts\Test is denied

I started getting this really strange error while using a set of 3rd party controls & web parts from KWizCom (was working perfectly well on my dev box but stopped working on prod box):

Access to the path 'C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\template\layouts\KWizCom_WikiPlus\WPlibFiles\wkptmpl.aspx' is denied

SOLUTION
1) Goto the corresponding folder under layouts (in my example KWizCom_WikiPlus), right click and then select Properties. Click on Security Tab and add the following accounts, namely NETWORK_SERVICE, WSS_ADMIN_WPG and WSS_RESTRICTED_WPG_V4 and give them "Full Control"

2) Click on "Advanced Settings" and Check Include inheritable permissions... and Replace all child objects permissions... and click OK

This should fix the "... access denied ..."

Friday, April 15, 2011

Open Links in a new window in SharePoint 2010

Beleive it or not, but SharePoint 2010 OOB does not support opening links in a new browser window when using the URL field/column. The best work around is to:
  1.  open the page with the XSLTViewWebpart that displays the hyperlinks in SharePoint designer.
  2. Now Click on Design tab on SharePoint Designer and select "Customize XSLT > Customize Entire View".
  3. Then locate your <a> tag and you would note that the attribute value set to href='{$url}'. Beside this attribute include the following - onclick="window.open(this.href); return false;" onkeypress="window.open(this.href); return false;"
  4. Save and Preview the page in browser and eureka the links for the above web part will now open in new browser window

soap:ServerServer was unable to process request. ---> Value does not fall within the expected range.

If you renamed your SharePoint site or added a new Alternate access mapping (access via central admin), then use the new mapped name using SharePoint Designer 2010 (as opposed to the servename you might be using now). And you would notice that this error "soap:ServerServer was unable to process request. ---> Value does not fall within the expected range." goes away...

Friday, April 08, 2011

How to hide View All Site Content for everyone except for Admin users in SharePoint 2010

look for this tag on default.master or the custom master page you are using:

<SharePoint:ClusteredSPLinkButtonid="idNavLinkViewAllV4"runat="server"PermissionsString="ViewFormPages"NavigateUrl="~site/_layouts/viewlsts.aspx"ImageClass="s4-specialNavIcon"ImageUrl="/_layouts/images/fgimg.png"ImageWidth=16ImageHeight=16OffsetX=0OffsetY=0Text="<%$Resources:wss,quiklnch_allcontent_short%>"

Replace the PermissionsString property in above tags from "ViewFormPages" to "ManageWeb"
accesskey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>

Hide the Recycle Bin link on the left hand bar for non-admin users in SharePoint 2010

look for this tag on default.master or the custom master page you are using:

<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" id="v3idNavLinkRecycleBin" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems" />
and the tag

<SharePoint:ClusteredSPLinkButtonrunat="server"NavigateUrl="~site/_layouts/recyclebin.aspx"ImageClass="s4-specialNavIcon"ImageUrl="/_layouts/images/fgimg.png"ImageWidth=16ImageHeight=16OffsetX=0OffsetY=428id="idNavLinkRecycleBin"Text="<%$Resources:wss,StsDefault_RecycleBin%>"CssClass="s4-rcycl"PermissionsString="DeleteListItems" />
Replace the PermissionsString property in above tags from "DeleteListItems" to "ManageWeb"

Friday, March 25, 2011

How to restore SharePoint 2010 Site Templates especially for Sites migrated from MOSS

After much painful debugging, I managed to resolve the issues related to Site Template save and restore for SharePoint 2010 based Sites. I noted that the SharePoint 2010 site itself had corrupted lists "Calendar", “Issue” etc (which does not get migrated properly from MOSS), which I had to delete and then created a new lists (such as “IssuesRegister”) in SharePoint 2010 and painfully relinked all workflows, data views, dispforms etc. I also deleted all the master pages (starting with clarity_) and styles library as they were remains from MOSS/SharePoint Online instance and was causing incompatibility issues. Anyways after all this, I saved the site as Site Template and EUREKA IT WORKED!!

Once I got the Site Template, I restored the site on new server and got a series of missing features exceptions (with correlation IDs - for example "The site template requires that the Feature {e34b0b8e-6e21-49ad-8d2f-530a29d61175} be installed on the farm or site collection"). I painfully debugged through each missing feature ID and learned the following (in a very painful way again)
1)   Ensure that all Site Collection and site Features in Source and Destination SharePoint servers are identical.
2)   I used the Powershell script Get-SPFeature -Site <Site Collection name> | Sort Id | FT DisplayName,Id to get all features deployed and matched against the list of feature names from here against the corresponding missing feature complained by SharePoint 2010 on the new box. Once I identified the feature missing, I went ahead and enabled the feature (see point 2 below)
3)      The Following features are required for restoring all SharePoint 2010 Site Templates that were migrated from MOSS (For e.g. - http://shp2010test is the new server where I tried restoring the new site based on SharePoint 2010 Template) – USING POWERSHELL:
a.       Enable-SPFeature LocalSiteDirectorySettingsLink -Url http://shp2010test
b.      Enable-SPFeature InPlaceRecords -Url http://shp2010test
c.       Enable-SPFeature SignaturesWorkflow -Url http://shp2010test
d.      Enable-SPFeature HelpLibrary -Url http://shp2010test
e.      Enable-SPFeature LocationBasedPolicy -Url http://shp2010test
f.        Enable-SPFeature OpenInClient -Url http://shp2010test
g.       Enable-SPFeature MobileExcelWebAccess -Url http://shp2010test
h.      Enable-SPFeature TaxonomyFieldAdded -Url http://shp2010test
4)      Strangely there was no theme applied to new site and so I had to reset the theme on this new site to inherit from parent and EUREKA! The site was live and all workflows seems to be working ok!

Anyways all my pain and suffering today would hopefully lead to more seamless and easy migration from SharePoint 2007 to SharePoint 2010 and then moving migrated sites between SharePoint 2010 servers.

Sunday, March 13, 2011

Hide List Columns on Display, Edit and New Forms using JQuery

Follow the steps below to quickly hide List Columns on Display, Edit and New Forms using JQuery:
1) Create a scripts library in your site (or use the one you currently use to store your Javascript/*.js files)
2) Download the latest version of the JQuery file from here - http://code.jquery.com/jquery-1.5.1.min.js
3) Copy the above *.js files (namely "jquery-1.5.1.min.js") to the scripts folder created in Step 1
5) Open the form/page (such as NewForm.aspx or EditForm.aspx) where you want to hide editable list columns and add the following script at the end of the page (preferably below the end </style> tag:


<script language="javascript" type="text/javascript" src="/board/scripts/jquery-1.5.1.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
  $(nobr:contains("All Day Event")').closest('tr').hide();

});
</script>
6) Ensure that you replace the List Column name that you want to hide in the above script sample
7) Also note that on DispForm.aspx, you need to slightly modify the above script and look for "h3" tag instead of "nobr" tag in the above script

Auto populate current logged in user name in SharePoint 2010 People Picker control

Follow the steps below to Auto populate current logged in user name in SharePoint 2010 People Picker control:
1) Create a scripts library in your site (or use the one you currently use to store your Javascript/*.js files)
2) Download the latest version of the JQuery file from here - http://code.jquery.com/jquery-1.5.1.min.js
3) Dowload the latest version of the SPServices JQuery library from here - http://spservices.codeplex.com or http://spservices.codeplex.com/releases/55660/download/171214
4) Copy the above *.js files (namely "jquery-1.5.1.min.js" and "") to the scripts folder created in Step 1
5) Open the form/page (such as NewForm.aspx) where you want to default the People Picker control to the current user logged in and add the following script at the end of the page (preferably below the end style tag:


<script language="javascript" type="text/javascript" src="/board/scripts/jquery-1.5.1.min.js"></script>
<script language="javascript" type="text/javascript" src="/board/scripts/jquery.SPServices-0.6.0.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
 var userName = $().SPServices.SPGetCurrentUser({
  fieldName: "Name"
 });
 $("textarea[title='People Picker']").val(userName);
 $("div[title='People Picker']").text(userName);
});
</script>








Note - you need to replace the src property values above to reflect the correct path to the Javascript files downloaded in above steps and saved in the "scripts" folder.