I managed to upload a file (crud PUT khe khe 🙂 from Linux to Sharepoint.
The absolute path of the file is:
http://myhost/mysite/reports/2010-04-13/file.txt
Now, I’m trying to add some metadata to the file:
from suds.transport.https import WindowsHttpAuthenticated
url='http://myhost/mysite/_vti_bin/lists.asmx?WSDL'
n=WindowsHttpAuthenticated(username='me',password='password')
from suds.client import Client
c=Client(url,transport=n)
xml="""<Batch OnError='Continue' PreCalc='' ListVersion='0'>
<Method ID='1' Cmd='Update'>
<Field Name='ID'/>
<Field Name='FileRef'>%s</Field>
<Field Name='Jurisdiction'>%s</Field>
</Method>
</Batch>"""
fn = 'http://myhost/mysite/reports/2010-04-13/file.txt'
print c.service.UpdateListItems('reports',xml % (fn,'UK'))
The code returns:
soap:Server
… and nothing happens.
Am I missing anything? Is there any other way to do it?
Thanks
Found it! 🙂
Instead of a plain text XML one must use DOM objects, something like this:
Now it works perfect!