I'm trying to upload a file to SharePoint programmatically via a Mac Application that I am currently writing. I can use the GetListItems webservice to retrieve a list of files, and all authentication etc works correctly. I form the SOAP message myself as follows:
At first I thought I just had the Objective C side written incorrectly, but I've been using the HTTP request extension for Firefox, 'Poster', and still can't get it to work.
The soap message in Poster that I construct is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CopyIntoItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<SourceUrl>http://null</SourceUrl>
<DestinationUrls>
<string>myurl.com/Shared Documents/Documents/TestingFile.txt</string>
</DestinationUrls>
<Stream>VGVzdGluZyB0ZXN0aW5n</Stream>
</CopyIntoItems>
</soap:Body>
</soap:Envelope>
The stream (at the moment) is just some data, to see if I can get it to work. I read that setting the SourceUrl as http://null, can help in some instances. I also read that the DestinationURL needs to be the full path. The problem here is:
1) If I put the URL without https:// then I get a response of:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><CopyIntoItemsResponse
xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<CopyIntoItemsResult>0</CopyIntoItemsResult><Results><CopyResult ErrorCode="Success"
DestinationUrl="myurl.com/Shared Documents/Documents/TestingFile.txt" /></Results>
</CopyIntoItemsResponse></soap:Body></soap:Envelope>
2) If I put the full path, e.g.
https://myurl.com/Shared Documents/Documents/TestingFile.txt
then the result tells me the same as before, except for this bit:
<CopyResult ErrorCode="Unknown" ErrorMessage="Object reference not set to an instance of an
object."
DestinationUrl="https://dbp.btfinancialgroup.com/Shared%20Documents/Papers/TestingFile.txt"
/>
3) If I put the full path, in quotes, e.g.
"https://myurl.com/Shared Documents/Documents/TestingFile.txt"
then the results tell me the same as the first, e.g. that it was successful, but with a destinationURL of this:
DestinationUrl=""https://dbp.btfinancialgroup.com/Shared
Documents/Papers/TestingFile.txt""
In ALL of these scenarios, the file does not exist in the destination at the end of the request.
I'm really stuck, as most online suggestions are for remedying C# problems, which use the .net protocols for connecting to SharePoint.
Any suggestions?
Thanks