SharePoint of the Day #34

If you are working with Lookup columns you can cast the list item values into SPFieldLookupValue objects to retrieve the individual properties:
SPFieldLookupValue value = new SPFieldLookupValue(item["LookupColumn"].ToString());
int lookupID = value.LookupId;
string lookupValue = value.LookupValue;
Delicious Digg This Post

Posted under Developer

This post was written by spotd on May 18, 2009

Tags:

SharePoint of the Day #24

You can cast item values into a more manageable type if you know the base field type. For example, cast SPListItem["url"] into a SPFieldUrlValue object to access the Url and Description as named properties:
SPFieldUrlValue v = item["Url"];
string url = v.Url;
string description = v.Description;
Delicious Digg This Post

Posted under Developer

This post was written by spotd on May 4, 2009

Tags:

SharePoint of the Day #4

To get the value for a list item’s columns, use the indexer on the SPListItem:
string title = item["Title"];
Delicious Digg This Post

Posted under Developer

This post was written by spotd on April 6, 2009

Tags: