We are migrating a large directory structure of documentation into SharePoint 2007. In our tests, SharePoint obviously sets the created and modified date to the upload time. Is there anyway to change that to the information from the file?

We are already setting various other metadata in our upload script, but it appears that we can't modify those values.


Here are some more details on using the API to update the created and modified dates on items in SharePoint:

SPSite site = new SPSite("http://sharepointsite/subsite");
SPWeb web = site.OpenWeb();
SPList list = web.Lists["My List"];
web.AllowUnsafeUpdates = true;
foreach (SPListItem item in list.Items)
   item["Modified"] = "Set the date";
   item["Created"] = "Set the date";
| improve this answer | |
  • Unfortunately this will only modify the dates of the SPListItem, but the containing thread will still have today's date/time. – niaher Mar 20 '12 at 11:33

You can do it through the API, the Created property on SPListItem is writable.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.