1
我有一個名爲DropOffLibrary的文檔庫。另外我在這個庫中有一個查找列ElDocsBatch。所以我需要設置一個具體的值如何在文檔庫中設置查找字段?(Sharepoint 2010)
SPFieldLookupValue newValue = new SPFieldLookupValue(11,"Account");
這個查找字段。
我有一個名爲DropOffLibrary的文檔庫。另外我在這個庫中有一個查找列ElDocsBatch。所以我需要設置一個具體的值如何在文檔庫中設置查找字段?(Sharepoint 2010)
SPFieldLookupValue newValue = new SPFieldLookupValue(11,"Account");
這個查找字段。
最後我解決我的問題。=))
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;