rtejada
Joined: 23 Feb 2006
Posts: 1
|
Posted:
Thu Feb 23, 2006 8:45 pm Post subject:
Need help with FPSE "Put Document" method |
|
|
Hi
I am working with the RPC Put Document method to updload a document to WSS document library. I can make it to work with the overwrite put option, but it does not work with the edit put_option.
The problem I have with the overwrite option is when the document is checked in, a new undesirable version is created when I upload the document. I am trying to mimic the office 2003 behaivor that allows to save a checked in document and modify its metadata.
My code looks like it
Public Sub PutDocument(ByVal weburl As WebUrl, ByVal localFile As String, ByRef returnCode As String)
Dim postData As String
postData = "method=put document:6.0.2.5523"
postData += "&service_name=/"
postData += "&document=[document_name=" & weburl.FileUrl & ";meta_info=[]]"
postData += "&put_option=edit"
postData += "&comment="
postData += "&keep_checked_out=false"
Dim myWebClient As New WebClient
myWebClient.Headers.Add("X-Vermeer-Content-Type", "application/x-www-form-urlencoded")
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
myWebClient.Headers.Set("Accept", "auth/sicily")
myWebClient.Headers.Add("Cache-Control", "no-cache")
myWebClient.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim postArray As Byte() = Encoding.UTF8.GetBytes(postData)
Dim responseArray As Byte() = myWebClient.UploadData(url, "POST", postArray)
returnCode = HtmlDecode(Encoding.UTF8.GetString(responseArray))
If returnCode.IndexOf("msg=") > -1 Then Exit Sub
myWebClient.Credentials = System.Net.CredentialCache.DefaultCredentials
myWebClient.UploadFile(weburl.SiteUrl & "/" & weburl.FileUrl, localFile)
End Sub
The returnCode variable I am getting looks like this
"<html><head><title>vermeer RPC packet</title></head>
<body>
<p>method=put document:6.0.2.5523
<p>status=
<ul>
<li>status=589825
<li>osstatus=0
<li>msg=The file Shared Documents/test/0003.dwg has been modified by DEV\Administrator on 18 Feb 2006 18:51:25 -0500.
<li>osmsg=
</ul>
<p>message=could not put document 'Shared Documents/test/0003.dwg' as 'Shared Documents/test/0003.dwg'
I will really appreciate any help
Regard
Raul |
|