Reputation: 449
When I upload files to SharePoint using FPRC with the following code to set vti_timelastmodified the Modified date shown is always the current date:
Public Sub UploadSharepointFile(ByVal sSourcePath As String, ByVal sContent As String, ByVal SiteURL As String, ByVal DocName As String, _
Optional ByVal sOrigPath As String, Optional ByVal sOrigName As String, _
Optional ByVal checkincomment As String, Optional ModDate As Date, Optional FileID As Long)
Dim stream As New ADODB.stream
Dim stream2 As New ADODB.stream
Dim xmlHTTP As New MSXML2.xmlHTTP
strHeader = "method=put+document%3a12.0.4518.1016" & _
"&service_name=%2f" & _
"&document=[document_name=" & Escape(DocName) & _
";meta_info=[Original%20Path%3bSW%7c" & Escape(sOrigPath) & _
";Original%20Name%3bSW%7c" & Escape(sOrigName) & _
";vti_timelastmodified3bTR%7c" & Format(ModDate, "DD+MMM+YYYY+hh:mm:ss") & _
"]]&put_option=overwrite,createdir,migrationsemantics" & _
"&comment=" & _
"&keep%5fchecked%5fout=false" & vbLf
byteArray = StringToByteArray(strHeader)
stream.Open
stream.Type = 1 ''adTypeBinary
stream.Write byteArray
stream2.Open
stream2.Type = 1 'adTypeBinary
stream2.LoadFromFile sSourcePath
stream2.CopyTo stream, -1
stream.Position = 0
'Set xmlHTTP = CreateObject("MSXML2.XMLHTTP")
xmlHTTP.Open "POST", SiteURL + "/_vti_bin/_vti_aut/author.dll", False, UserName, Password
xmlHTTP.setRequestHeader "Content-Type", "application/x-vermeer-urlencoded"
xmlHTTP.setRequestHeader "X-Vermeer-Content-Type", "application/x-vermeer-urlencoded"
xmlHTTP.setRequestHeader "User-Agent", "FrontPage"
xmlHTTP.send stream
If I set a custom date field 'Original Modified' as follows then the correct date appears in the new field
strHeader = "method=put+document%3a12.0.4518.1016" & _
"&service_name=%2f" & _
"&document=[document_name=" & Escape(DocName) & _
";meta_info=[Original%20Path%3bSW%7c" & Escape(sOrigPath) & _
";Original%20Name%3bSW%7c" & Escape(sOrigName) & _
";Original%20Modified%3bTR%7c" & Format(ModDate, "DD+MMM+YYYY+hh:mm:ss") & _
"]]&put_option=overwrite,createdir,migrationsemantics" & _
"&comment=" & _
"&keep%5fchecked%5fout=false" & vbLf
End If
Is there a way in can modify vti_lasttimemodified on uplaod to a preset value?
Simon Kravis
Upvotes: 1
Views: 610