1: 设置超链接项的办法
使用 SPFieldUrlValue class
SPList list = web.Lists["Links"];
SPListItem newLink = list.Items.Add();
SPFieldUrlValue value = new SPFieldUrlValue();
value.Description = "test";
value.Url = "http://www.microsoft.com/sharepoint";
newLink["URL"] = value;
newLink.Update();
2: 得到超级链接项
SPList list = web.Lists["Links"];
SPListItem existingLink = list.Items[0];
SPFieldUrlValue value = new SPFieldUrlValue(existingLink["URL"].ToString());
string linkTitle = value.Description;
string linkURL = value.Url;
3: 设置查找项
使用SPFieldLookupValue 类
SPList list = web.Lists["Branches"];
SPListItem newBranch = list.Items.Add();
newBranch["Title"] = "A New Branch";
SPFieldLookupValue newValue = new SPFieldLookupValue(14,"Program Operations");
newBranch["Group Name"] = newValue;
newBranch.Update();
4: 得到查找项
SPList list = web.Lists["Branches"];
SPListItem existingBranch = list.Items[0];
SPFieldLookupValue group = new SPFieldLookupValue(existingBranch["Group Name"].ToString());
int lookedUpItemID = group.LookupId;
string lookedUpItemTitle = group.LookupValue;