Everything SharePoint and XAML

My continuous learning of SharePoint, XAML, Silverlight, Windows Phone 7, Windows 8, 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"]);

Advertisements

Sorry, the comment form is closed at this time.

 
%d bloggers like this: