无法设置使用 FrontPage RPC 上传到 SharePoint 的文件的修改日期
当我使用 FPRC 使用以下代码将文件上传到 SharePoint 来设置 vti_timelastmodified 时,显示的修改日期始终是当前日期:
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
中可以将uplaod上的vti_lasttimemodified修改为预设值吗?
西蒙·克拉维斯
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论