SharePoint - How to retrieve from or save data in SharePoint Lib programatically?
Asked By Prasanna Belsare on 08-May-13 02:17 AM
I am using SharePoint 2010. In SharePoint site there is a Form Library which has column "Current Date". I want to create a timer job which will update this column with current system date once in a day.
I know this is possible with SharePoint list with following code:
SPList shippingList = oSPWeb.Lists["Candidate Info"];
SPQuery listQuery = new SPQuery();
listQuery.Query = "<Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where>";
SPListItemCollection Items = shippingList.GetItems(listQuery);
if (Items.Count > 0)
foreach (SPListItem item in Items)
SPListItem itemToUpdate = shippingList.GetItemById(item.ID);
itemToUpdate["Current Date"] = DateTime.Now;
But this code is not working with me for SP Form Library. Is anything missing in above code, or is any other way to achieve the above requirement.