Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In SharePoint Document Library, there is column named “Modified” and it’s read-only.
I have written the following code snippet through object tried to update the Modified column but didn’t get the success.
1: //Create the SPsite Object. Please change quoted value to your site URL.
2: SPSite site = new SPSite("https://blre3r15-5:3000/sites/PublishingSite");
3: SPWeb web = site.OpenWeb();
4: SPList list = web.Lists["Documents"];
5:
6: foreach(SPListItem item in list.Items)
7: {
8: Console.WriteLine("File Modified Last Date :- "+ item.File.TimeLastModified.ToString());
9: Console.WriteLine("Item modified :-" + item[SPBuiltInFieldId.Modified].ToString());
10: item.File.CopyTo("https://blre3r15-5:3000/sites/PublishingSite/Mydocument/" + item.File.Name);
11: //item.CopyTo("https://blre3r15-5:3000/sites/PublishingSite/Mydocument/" + item.File.Name);
12: }
13: web.Update();
14: web.Close();
15: site.Close();
16:
17: Console.ReadKey();
I have written the RPC protocol but didn’t find the success because it’s read-only.
1: string postBody = String.Format("method=put+document&service_name=/&document=[document_name=Documents/test.txt;meta_info=[vti_timelastmodified;TW|23+Nov+2009+16:30:14+-0000]]"+
2: "&put_option=edit&comment=&keep_checked_out=false");
3:
4: HttpWebRequest objRequest = (HttpWebRequest)HttpWebRequest.Create("https://blre3r15-5:9000/sites/NewSite/_vti_bin/_vti_aut/author.dll");
5: objRequest.Method = WebRequestMethods.Http.Post;
6: objRequest.Credentials = CredentialCache.DefaultCredentials;
7: objRequest.ContentLength = postBody.Length;
8: objRequest.ContentType = "application/x-www-form-urlencoded";
9: objRequest.Headers.Add("X-Vermeer-Content-Type", "application/x-www-form-urlencoded");
10: StreamWriter objWriter = new StreamWriter(objRequest.GetRequestStream());
11: objWriter.Write(postBody);
12: objWriter.Close();
13:
14:
15:
16: HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
17: StreamReader objReader = new StreamReader(objResponse.GetResponseStream());
18: string strResponse = objReader.ReadToEnd();
19: objResponse.Close();
20:
21: Console.WriteLine(strResponse);
22: Console.ReadKey();
In nutshell, we can’t update this property.