I am trying to update a field that I added to a document library> below is the code. I know I have been successful using similar code to update a list library but this does not work for a document library. Can I please get some assistance with modifying the code below to update a document Library (li.text is a value that I get from a selected listbox
using (SPSite docSite = new SPSite(SPContext.Current.Web.Url))
{
using (SPWeb doclstweb = docSite.OpenWeb())
{
doclstweb.AllowUnsafeUpdates = true;
SPList doclist = doclstweb.Lists["Documents"];
SPQuery docQuery = new SPQuery();
docQuery.Query = "<Where><Eq><FieldRef
Name='Title' /><Value Type='Text'>" + li.Text + "</Value></Eq></Where>";
// SPListItem doclistItem = doclist(docQuery);
SPListItemCollection docboItems = doclist.GetItems(docQuery);
foreach (SPListItem doclstitem in docboItems)
{
doclstitem["AddedToExtSite"]
= "Yes";
doclist.Update();
}
doclstweb.AllowUnsafeUpdates = false;
lblMsg.Visible = true;
lblMsg.Text = " - document title " +
li.Text;
}
}
IPW