//
// Returns the Single Value of a Lookup Field.
//
private static string GetFieldValueLookup(this SPListItem item, string fieldName)
{
if (item != null)
{
SPFieldLookupValue lookupValue = new SPFieldLookupValue(item[fieldName] as string);
return lookupValue.LookupValue;
}
else
{
return string.Empty;
}
}
Example:
// Reads the value of a SPFieldLookup field
string value = item.GetFieldValueLookup("LookupFieldName");
About Me
Labels
- General (1)
- SharePoint 2007 (10)
- SharePoint 2010 (3)
Buddies Blogs
Blog Archive
-
▼
2010
(9)
-
▼
February
(9)
- Opening PDF in separate window of Web Application...
- SharePoint Groups vs. Active Directory Groups
- If Current Navigation is not same as Parent Site N...
- How to Retrieve Text from Enhanced Rich Text Colum...
- Reading & Writing SPFieldUrl field values Programm...
- Setting Multiple Values of SPFieldLookup Column Pr...
- Setting Single Value of SPFieldLookup Column Progr...
- Reading Multiple Values of SPFieldLookup Column Pr...
- Reading Single Value of SPFieldLookup Column Progr...
-
▼
February
(9)
Posted by
Sreedhar Chavali
Wednesday, 17 February 2010
Labels:
SharePoint 2007
Subscribe to:
Post Comments (Atom)