c# - How to set lookup field in document library?(sharepoint 2010) -


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

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

For this lookup field.

Finally I have solved the problem I have. =))

  SPListCollection collLists = oWeb.Lists; // Get the foreach of all the lists (SPList oList in collLists) {if (oList.BaseType == SPBaseType.DocumentLibrary) // Search for all libraries {SPDocumentLibrary oDocumentLibrary = (SPDocumentLibrary) Ollist; String name = oDocumentLibrary.Title.ToString (); Get the name (name == "Library name") // Library that you want {SPListItem row = oDocumentLibrary.Items [i]; // Get an element by ID in the library SPFieldLookupValue newValue = New SPFieldLookupValue (id, "LookupFieldValue"); Line ["field_name"] = new value;  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -