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.

link|improve this question

feedback

2 Answers

up vote 2 down vote accepted

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";
   item.UpdateOverwriteVersion();
}
link|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 at 11:33
feedback

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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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