I have been able to successfully create a Picture Library, complete with custom columns, and then access these custom columns in code (in a Web Part).

However, when trying to do the same with a List, I get exceptions attempting to access the Title field and also no Properties are present in the ListItems:

I have setup a standard List with several custom columns and ensured everything I've added to the List has these fields filled in.

The code is:

SPList list = web.Lists[_docLibId];

if (list.BaseType == SPBaseType.GenericList)


_currentList = list as SPList;

SPListItemCollection items = list.GetItems(_currentView);

int i = 1;

foreach (SPListItem li in items)


Cell12.Text = li.Title

Cell11.Text = li.Properties["Text"].ToString();


li.title throws exception, as does the call to li.Properties["Text"].

A look while debugging shows in fact there are no properties at all in the li object and also the Title field throws an exception as shown here.


ListItems: {Microsoft.SharePoint.SPListItemCollection}

Name: 'li.Name' threw an exception of type 'System.ArgumentException'

Properties: Count = 0

Title: 'li.Title' threw an exception of type 'System.ArgumentException'

Does anyone have any clues about this one