views:

142

answers:

1

I have a document library named DropOffLibrary. Also I have a lookup column ElDocsBatch in this library. So I need to set a specific value

SPFieldLookupValue newValue = new SPFieldLookupValue(11,"Account");

for this lookup field.

A: 

Finally i've solve me problem.=))

SPListCollection collLists = oWeb.Lists; //Get All lists
foreach (SPList oList in collLists)
{
   if (oList.BaseType == SPBaseType.DocumentLibrary) //Serach for all Libraries
   {
      SPDocumentLibrary oDocumentLibrary = (SPDocumentLibrary)oList;
      string name = oDocumentLibrary.Title.ToString();

      if (name == "LibraryName") //Get library what you need
      {
         SPListItem row = oDocumentLibrary.Items[i]; //get an element by id in library
         SPFieldLookupValue newValue = new SPFieldLookupValue( id , "LookupFieldValue");
         row["field_name"] = newValue; 
Nikita