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)


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,
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.

Within the RDP session presss the ALT button several times.

Monday, December 19, 2011

SP2010 Doc icon does not link to document

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.

Microsoft has recognized this as a bug and provided a fix.;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.


SP2010 document check out issue

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."

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

  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
    : 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

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.

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.


Thursday, December 8, 2011

SP2010 Missing - "Alert Me"

If outgoing email is not configured for a SP 2010 environment then the "Alert Me" button will not be displayed on the ribbon.

SP2010 Table of Contents Webpart Limit 20

1. Navigate to subsite where the issue exists. 
2. Click Site Actions -> Site Settings
3. Click Navigation
4. Set a higher value greater than 20 for Current Navigation.
5. Save and close.

SP2010 ListView Ribbon missing

Post upgrade to SP2010 from SP2007 the ribbon is missing on some list view pages (allitems.aspx).

This happens if there is a CEWP or any other webpart or any modifications done to the default list pages like allitems.aspx. Once the pages are modified SP treats them as application pages and hence the ribbon is modified.

You will notice that clicking on the list view webpart on the page will bring the ribbon back or clicking on one the item checkboxes.

You can add some JS to a CEWP to fix this problem as mentioned in the reference below. The JS simply sets focus to the list view webpart once the page has loaded.


Wednesday, December 7, 2011

SPDeletedSite Cmdlets

SPDeletedSite commandlets only work if you have deleted the site collection via the browser ui or the object model.  If you are an admin and you have explicitly called Remove-SPSite, then your site collection is not available to the SPDeleteSite commandlets. 


Tuesday, December 6, 2011

SP2010 - Send link in email

Send link in email option is missing in SP2010 which was available in SP2007.

With IE (Not Chrome, not sure about firefox) you can hold down CTRL and click the title - this then opens up the edit form with ID?=XXX (i.e. no dialog) in a new window - then easy to copy and paste into email.


Monday, December 5, 2011

SP2010 - CallStack CustomError

Although you have set callstack=true, customerrors=Off and compilation=debug in web.config of your web application, you still do not get the stack trace. 

Set customerrors=Off here,
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\web.config 


Friday, December 2, 2011

STSADM ' - ' Command line error

All parameters passed to stsadm command are correct but it still complains about "Command line error". This is an encoding issue.

e.g. If this command does not work on cmd prompt,
       stsadm -o enumsites -url http://myurl -databasename dbname
      - Paste this command in a notepad and try to search for -databasename 
      - Notepad will return "cannot find -databasename " although you can see it there.
The '-' is not getting encoded correctly. Simply delete the - and retype it in notepad. Copy and paste it in cmd prompt and execute. It will work. This problem may occur with any '-' parameter.


Powershell - Non CLS compliant type

The field/property: "Id" for type: "Microsoft.SharePoint.Administration.SPContentDatabase" differs only in case from the field/property: "ID". Failed to use non CLS compliant type.
The way that you have to work around this issue is to get a handle to the type’s property using reflection and then invoke the SetValue() method.
$maxProp = [Microsoft.SharePoint.Administration.SPContentDatabase].GetProperty("MaximumSiteCount")
$maxProp.SetValue($siteCol.ContentDatabase, 1, $null)
If you want to get the property value:
$returnVal = $maxProp.GetValue($siteCol.ContentDatabase, $null)

Reference :