0
votes

I'm working with a customer that needs to migrate documents from their current document management system (not Sharepoint) into Sharepoint MOSS 2007 retaining document history and metadata. I've written a proof of concept using the Sharepoint web services and that looks promising, but the snag so far seems to be programmatically setting the created date/time and user. The webservices allow the fields to be set but implicitly override them to be the currently logged in user + date/time. For obvious reasons, I need to be able to keep the original created date/time and user on migration. Does anyone know the best way to approach this problem?

1

1 Answers

0
votes

Have you tried programmatically adding the document and then updating those fields? Perhaps you could even do this directly on the object in SP2K7 Database if you have the object id.

Here's an article that might be able to help you out a little.

http://www.eggheadcafe.com/software/aspnet/29904945/change-modificationcreat.aspx

Dim vLocalFileName As String
Dim file As SPFile
pLocation = "http://myserver/Docs/Documents/TestDoc.doc"
vLocalFileName = "C:\TestDoc.doc"
Dim site As SPWeb = New SPSite("http://myserver/Docs").OpenWeb()

Dim fStream As FileStream
fStream = New FileStream(vLocalFileName, FileMode.Open)
Dim contents(fStream.Length) As Byte
fStream.Read(contents, 0, CInt(fStream.Length))
fStream.Close()

file = site.Files.Add(pLocation, contents)
Dim ListItem As SPListItem
ListItem = file.Item
ListItem("Title") = "updatetest"
ListItem("MyLookupField") = "1"
ListItem("Created") = "2007/01/01 10:00"
ListItem("Modified") = "2007/01/01 11:00"
ListItem.Update()

file.CheckIn("", SPCheckinType.MajorCheckIn)