vti_timelastmodified を設定する次のコードで FPRC を使用して SharePoint にファイルをアップロードすると、表示される更新日は常に現在の日付になります。
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
次のようにカスタム日付フィールド「元の変更日」を設定すると、正しい日付が新しいフィールドに表示されます
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
アップロードの vti_lasttimemodified をプリセット値に変更する方法はありますか?
サイモン・クラヴィス