Friday, December 23, 2011

SP2010 - Cannot create new site collections


Scenario: I was not able to provision a new project web access instance on a Project Server 2010 / SharePoint 2010 environment. Further troubleshooting this problem I realized that no new site collections could be created on the environment under the specific problematic web application only. Below is the error from ULS:

Failed to provision site [project web access instance name] with error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(IEnumerable`1 contentDatabases, Guid siteIdToAvoid, Guid webIdToAvoid, SPContentDatabase database, SPContentDatabase databaseTheSiteWillBeDeletedFrom)

Solution:

This is a case of at least 1 orphaned database associated to the problematic web application. 

1. Run below powershell command to get GUID of web application.
get-spwebapplication | ? {$_.displayname -eq "Problematic Web Application Name"} | fl

2. Run this SQL query against configuration database.
select ID, Name, CAST (properties as xml) from Objects where ID = 'GUID of webapp from Step 1'

3. The results returned from step 2 will have 1 column with the properties as xml. Click on the results and it should open a new window in SQL Mgmt studio with xml output.

4. Search for the word "m_Databases" in the xml output.

5. Carefully read through the tag that stores the above searched word. You should be able to see fld tags. Find out a tag which has fld tag with value null. This is the orphan database. Its GUID is the xml line above where you found null.

6. Cross verify all databases currently associated with the web application and make sure this database is not getting used.

7. Run below powershell script,
$webapp.contentdatabases.delete(‘ID-of-bad-content-db’) 
This script will throw an object reference error. Do not worry, it works its magic under the hood.

Try to create a new site collection now and it should work. 

Summary: The above problem occurs because if there one entry which has fld value set to null SharePoint thinks that that database is the most suitable one to create new site collections in. But since it is an orphaned database, it is unable to do so and reports the above error in ULS which is repeated every time a new site collection creation request is initiated with through SP user interface or Project Server interface.

Windows RDP ALT problem

When you open a new RDP session from a Windows machine sometimes the keyboard does not work correctly. 
For e.g.
Once the RDP session has started and you have logged in successfully, when you press the T button it switches between taskbar windows rather than simply typing the letter T. It looks like it performs the same function as ALT + T although ALT is not pressed.


Solution:
Within the RDP session presss the ALT button several times.

Monday, December 19, 2011

SP2010 Doc icon does not link to document

Scenario:
Site which are migrated from SP2007 to SP2010 have lost the automatic link of doc icon, i.e. pdf, word, excel etc to the document. Users have implemented list view webpart where they used this functionality for one click opening of documents from any page.


Solution:
Microsoft has recognized this as a bug and provided a fix.
http://support.microsoft.com/default.aspx?scid=kb;en-US;2457975

SP2010 list view toolbar

If you want the SP2007 toolbar, with New, Upload, Actions and Setting buttons, edit the list view page and edit the list view webpart. Set the toolbar type dropdown to "Show Toolbar" option.


Reference: http://www.glynblogs.com/2011/02/displaying-the-list-toolbar-in-sharepoint-2010.html

SP2010 document check out issue

Scenario:
Users are not able to check out documents from document libraries. The error is returned is the message,
"The document cannot be checked out as it is already checked out to another user."


Solution:
Make sure the web application where the document library is hosted has a root site collection created.

Monday, December 12, 2011

Upload SP2007 list templates to SP2010

Solution:
  1. Rename the original .STP to .CAB
  2. Extract its manifest.xml and other contents (if any) to a local folder (lets call it [folder])
  3. Search for the ProductVersion element. This should have a value of 3
  4. Change its value to 4
  5. Repackage the manifest.xml into a .CAB. I've done this by using makecab.exe in the C:\Windows\System32 folder
    Syntax
    : makecab.exe [folder]\manifest.xml [folder]\{template-name}.cab
  6. Change the generated cabinet's extension from .CAB back to .STP and upload it into the _catalogs/lt

Sunday, December 11, 2011

Mount-SPContentDatabase Powershell bug

Scenario:
Mount-SPContentdatabase command fails with "object reference not set to an instance of an object" error.
At first these errors are only shown for Basic Meeting Workspace.


Solution:
Make sure you are not running "Mount-SPContentdatabase" command for the same database using the same powershell window. If yes, close the window and open a new SharePoint 2010 powershell window and continue the operation.




References:
http://www.ekhichdi.com/b/Object-reference-not-set-to-an-instance-of-an-object-upgrade-sharepoint-416.html


http://blogs.msdn.com/b/jorman/archive/2010/06/09/mount-spcontentdatabase-failing-on-blank-meeting-workspace.aspx