I upload file content using HTTP PUT with WinInet (it complies with WebDav and seems like the most supported way among different SharePoint versions). First I create request, then do multiple writes to the request handle (which should effectively write payload to socket) and then end the request.

The problem is that when something happens during upload (e.g. network filure) or I cancel it with closing request (socket) without final EndRequest call, the upload is not cancelled but server keeps lefts file (if file existed, it's content is lost).

How can I upload the file content ensuring that existing one is reverted if upload is not finished successfully?

PS: if simple terminating works with other HTTP-based API, please put a comment so I could know there is something wrong related to WinInet but not SharePoint.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.