Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

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.
share|improve this answer
    
Is there anyway(methods) to overwrite a file rather than Copy.asmx (I mean List.asmx methods - CheckIn, UpdateListItems etc). I noticed that in CheckIn and UploadListItems, there is no option to specify the file stream as we do in CopyIntoItem of Copy.asmx. Can I have a way to upload to SharePoint from a mobile device. (Means iPhone/Android devices)?. Only normal SharePoint webservices are available for mobile devices I think, we can not use any desktop based Apis which run using .net code. Can I get a reply soon? –  Sagar S. Kadookkunnan Jul 2 '12 at 14:28

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.

share|improve this answer

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.