Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 3 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();
}
share|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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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