Tuesday, January 31, 2012

STSADM import error

Scenario: You get this error although you have a valid export of a subsite from a site collection which you had taken using a farm account. You are trying to import using the farm account.

FatalError: The file cannot be imported because its parent web does not exist


Make sure that before you do the export the site is not set to readonly.

Saturday, January 28, 2012

Disaster Recovery - Server down

Scenario: For some reason, if the SharePoint installation gets corrupt on one of the front end's or application server in a SharePoint farm. If this is a front end server, users will get service errors when a request is sent to the faulting front end. If there is a load balancer that would greatly help the situation.


*If you have a load balancing solution, remove the faulting server from the load balancer first.

1. Uninstall SharePoint binaries from the server. If Project Server binaries are installed, uninstall that also from the Control Panel. This will automatically remove the server from the farm.

2. Reboot server
-After reboot open IIS and check if there are any orphan sites. If you see something like IIS_Site0, click on the Sites tab above it and remove the site.

3. Reinstall all binaries on the server, e.g.
   a. SharePoint binaries
   b. Project Server binaries
   c. SharePoint Foundation - SP1 
   d. SharePoint Server - SP1
   e. Foundation - June CU
   f. Server - June CU

4. Run psconfig using Configuration Wizard or powershell and choose to add the server to an existing farm. Provide configuration database information. The server will automatically be configured and added to the farm. If there is no other server in the farm hosting central admin, then this server will automatically be enforced to host central admin.

5. If custom solutions were installed on the server, during psconfig all the 14\hive folders will be automatically be provisioned. If any custom changes were made not using wsp's in the 14 hive then they will have to be manually re-done as the re-install process wipes out the 14 hive.

6. If the faulting server was the server where the search admin component was hosted and also if it served the query role, search will be broken. 
To restore the admin component use the below script (assuming there is only 1 search service application)

$varInstance = Get-SPEnterpriseSearchServiceInstance -local  
$varSearchApp = get-spenterprisesearchserviceapplication
set-spenterprisesearchadministrationcomponent –searchapplication $varSearchApp –searchserviceinstance $varInstance

7. Sometimes the crawl component may get stuck in a Recovering state. To resolve this, create a new crawl component with the same parameters on the same server. Once this is complete, you will notice that the old and new crawl component both come online. Delete the old crawl component.




Wednesday, January 25, 2012

SP2010 content and structure tool error

When users visit the content and structure tool then get an "object reference not set to instance of an object" error. Here is the stack trace,

"Server error in'/' application.
Object reference not set to an instance of an object."

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.evaluateTestAutomationId(CachedList cachedListToEval) +48
Microsoft.SharePoint.Publishing.Internal.WebControls.ObjectSerializer.get_AutomationId() +189
Microsoft.SharePoint.Publishing.Internal.WebControls.EcbEnabledTreeNode.RenderPreText(HtmlTextWriter writer) +183
System.Web.UI.WebControls.TreeNode.Render(HtmlTextWriter writer, Int32 position, Boolean[] isLast, Boolean enabled) +7748
System.Web.UI.WebControls.TreeNode.RenderChildNodes(HtmlTextWriter writer, Int32 depth, Boolean[] isLast, Boolean enabled) +962
System.Web.UI.WebControls.TreeNode.Render(HtmlTextWriter writer, Int32 position, Boolean[] isLast, Boolean enabled) +8926
System.Web.UI.WebControls.TreeView.RenderContents(HtmlTextWriter writer) +274
System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +41
ASP._layouts_sitemanager_aspx.__RenderForm1(HtmlTextWriter __w, Control parameterContainer) +1011
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +114
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +252
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +86
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +52
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +239
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +41
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +239
Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.RenderChildren(HtmlTextWriter writer) +57
System.Web.UI.Page.Render(HtmlTextWriter writer) +37
Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.Render(HtmlTextWriter writer) +57
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeSta

The content and structure tool is very sensitive to any kind of missing lists or subsites in the site collection. Possibly caused due to Publishing feature activation/deactivation or some other type of corruption

First we need to check if corruption exists using,
stsadm -o databaserepair

This will return the orphaned objects with the corresponding ID and WebID. If it does not return any results then you will have to write some powershell to get all lists in the site collection and check if any of them returns the famous "List does not exist" error when you browse to /site/subsite/_layouts/ListEdit.asps?List={GUID} page

In my case databaserepair returned some lists which were orphaned all from the same subsite.

I took the ID of 1 of the list which was orphaned and fired a SQL query against the content database.

select * from dbo.AllDocs with (nolock) where ListId='listID'

This query also returned the WebID associated with the ListId. In my case all the orphaned sites were from the same web and this web was deleted by an end user and hence it was in the recycle bin.

Here are the steps I am going to take to fix this,
1. Delete the items from the recycle bin and make sure it is completely deleted.
2. Run databaserepair cmd again to test for corruption
3. If everything works out the tool should be working again.

SP2010 search crawl error

The crawl log returns the following error while crawling some site collections in the farm, 
1. The object cannot be found
2. Cannot download the item

In my case this was because the site was not accessible from the index server. Try to open the site in a browser on the index server (assuming that host file entries are configured to point to itself). If it does not open or returns an error message "An unexpected error occurred"  on a white screen then it is because the server cannot connect to the database server.

If used,make sure the SQL alias is configured correctly for 32-bit and 64 bit configurations. Make sure the port number is correct. Make sure you can access the database instance using management studio with the same instance name configured in SharePoint.

SP2010 RecycleBin bug

If you delete a list or navigation item using the browser, and if recycle bin is enabled for the site the item is moved to the recycle bin. In SP2007 the deleted item is not shown in the regular views, i.e. in the all site content view or in the top navigation. In SP2010 SP1/June CU it does show up and if you use Powershell to open it, it does return a partial reference to the object, i.e. $web.Lists["deleted list name"] will show some properties of the list, but $web.Lists["deleted list name"] will throw an object reference not found error.

Delete the item from the recycle bin !

SP2010 Client Access License

Tuesday, January 24, 2012

SP2010 Site Templates

Issue 1:
If you create a site template by saving an existing site as template from site settings, it creates a user solution in the site collection and automatically activates it. You can then go ahead and create sites based on this template. If for any reason you delete the site created from the template and if the user solution was still active in site collection settings, then we will not be able to deactivate the solution at all. This leaves an orphaned solution in the site collection. There is no permanent fix for this problem at the moment. One workaround is to restore the deleted site from recycle bin and then deactivate the solution after which you can delete the site.


Issue 2
When you try to create a site template you are presented with the below error and the spinning processing icon,
InvalidOperationException: Error generating solution files in temporary directory.
ULS Logs error : List does not exist.

This situation occurs if you had enabled SharePoint Publishing feature on the site at one point in time before and then deactivated it later to save the site as template. The deactivation leaves references to some SharePoint internal lists but the lists themselves get deleted (My assumption). Hence you will not be able to create a template from such a site. Also, please note that this situation is not consistent, i.e. in some cases you are able to create site templates from a site which had SharePoint Publishing feature enabled previously.

If you google this error, you will notice that people talking about insufficient permissions on the temporary directory on the front-ends etc. Just to be sure that it is not the case make sure that you can create site templates from other sites in the same site collection or different site collections in the farm.

As a workaround you can recreate the source site artifacts for a clean template either manually or using powershell / custom code.

Monday, January 16, 2012

Upgrade Project Server 2007 sites to 2010.

Process to upgrade Project Server 2007 sites to 2010.

1. Make sure project wss site is in an isolated databases. If not, backup and restore site collection to different content databases by using a seperate temp web application.
2. Backup content dbs and project server databases from SQL Server (SP2007)
3. Restore content dbs and project server databases on SP2010/PS 2010 SQL server 
4. Run Mount-SPContentDatabase or add-contentdb commands for SharePoint content databases only, upgrade and attach SP content databases to project web application.
5. Create a new project web access site using Project service application management page,
    - Make sure you enter the same name of the site url which got upgraded in step 4.
    - Enter 4 Project server database names and create pwa.
6. Run Bulk project site update to fix project workspace link issue.

1. If you have project workspaces in your project server 2007 implementation remember to keep the same relative path name when you perform step 1 above.
i.e. /sites/projectworkspaces should be restored to temp web app and then upgraded to SP2010 as /sites/projectworkspaces and not with any other name. However for the pwa site name it may take a new name that needs to be restored.
2. Do not perform backup and restore of project workspace site collection to move between database for isolation. If you do it, the ID of the site changes and then Step 6 will not work as it performs an ID match to relink the pwa to the workspace sites.

Friday, January 13, 2012

Could not find webtemplate

Scenario: stsadm export worked fine for a subsite. stsadm import of the same subsite under a different sitecollection on the same farm under the same webapplication as a subsite failed with below error. And yes, the template is present on the environment. 

FatalError: Could not find WebTemplate #75820 with LCID 1033.

Since the template was installed and the source site works on the same environment to only way I found to proceed with the import was to manually modify the requirements.xml file located in the uncompressed export folder and remove the faulty webtemplate xml line.

Saturday, January 7, 2012

This SqlTransaction has completed; it is no longer usable.

Scenario: Using stsadm -o mergecontentdbs as a batch operation causes transaction logs to get filled up quickly.

Error in ULS - The transaction log for database 'Destination_ContentDBName' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases' 

Shrink transaction logs and retry operation.

Thursday, January 5, 2012

SharePoint troubleshoot HTTP 404 default.aspx

Users browsing to a SharePoint site are faced with HTTP 404 response.

In my case, there was a missing master page (deployed to the file system on the servers) which the site was referencing. This was because one of the solution was not installed on the farm.

To troubleshoot this issue, I followed the below procedure,
1. Download Process Monitor from technet systinternals website
2. Execute procmon on one of the web front ends. Include column username
3. Hit the site that return HTTP 404 error
4. Filter results in procmon window using specific username
5. Check for non-success results and you should see the file system access entries that will help understand point of failure.


Wednesday, January 4, 2012

SP2010 List Throttling

List throttling does not allow non-administrators to view items in list view web part for large lists more than 5000 items even when paging is applied.

1. Disable list throttling at web application level - NOT RECOMMENDED
2. Disable list throttling at list level - Can be done using Powershell. Make sure you isolate the site in a specific database if possible.
3. Use metadata navigation and filtering - http://msdn.microsoft.com/en-us/library/ee559293.aspx

SP2010 calculated column content type missing

Issue: SP 2010 Calculated columns cannot reference content type field as it computed type.

A very technical description can be found in below reference.