Everything SharePoint/Silverlight

My continuous learning of SharePoint, Silverlight, Office, VSTO, C#…

SharePoint Life Lessons #001

Posted by Steve Pietrek on February 26, 2008

Ran into a few anomalies I wanted to get down.

1. I was attempting to create a site using the stsadm command “createsite”. I was receiving the error:

The URL '/sites/intranet/' is invalid.  It may contain illegal characters, or be too long

My script was defined below:

"%SPDIR%binstsadm.exe" -o createsite -url http://localhost:22000/sites/intranet/ -ownerlogin localhostadministrator -owneremail administrator@sharepoint.net

The issue is with the trailing slash in the URL. It needs to be removed.

"%SPDIR%binstsadm.exe" -o createsite -url http://localhost:22000/sites/intranet/-ownerlogin localhostadministrator -owneremail administrator@sharepoint.net

The trailing slash did not cause issues with deletesite or installing/activating features.

2. When accessing fields in a Sharepoint list, I would receive the error:

Object set to null reference

I was using the code to access the field:

item["URL"].ToString();

The problem is the column was not required so there may not be any data in the column. To resolve, use the following code when accessing the field:

Convert.ToString(item["URL"]);

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>