Question

I am doing SharePoint implementation at iPhone/iPad side. I use SOAP/REST api calls for implementing this. One of my functionalities is to upload contents to SharePoint document libraries. I use CopyIntoItems webservice in Copy.asmx API. When I upload file with a new name it is uploading successfully and content is there. But If I try to upload document with a name of document that already exist there(with the exact path), gives me response 200 and upload process completed successfully. But the content is not updated, all the properties are reflected with the new file but the file there is still the old one.

Do anyone have an idea about how can we solve this issue? Please reply if somebody have a work around.

NB: I googled for some research and it gave me "You might need to delete the existing file before uploading the new one". Is that the only solution?. Can't we overwrite an existing file directly?

Was it helpful?

Solution

No, you can't overwrite using Copy.asmx, but an alternative would be:

  • Either write a custom Web Service which does the overwrite it.
  • (As you said) delete the existing file before uploading it's new version. Of course, in such case you'll loose version history.

OTHER TIPS

I was able to overwrite using Copy.asmx by putting the actual file name in the sourceUrl as opposed to the full Url. For instance if the url to the document is {servername}/sitename/documentlibrary/A0805051340561869296.txt, then just put A0805051340561869296.txt as the sourceUrl argument. This will create another version.

I removed the setting to require check out from my library, as well.

The document library can't require check out and the first parameter (sourceUrl) of the CopyIntoItems method must be the file name only (not the complete url). Works fine to me.

Good luck!

Another possible approach would be to check the document out, update it, then check the document back in. This could all be done through web services.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top