I've got a method that uses a WebRequest to upload a file to a sharepoint 2010 list/folder, using a PUT request, with the Overwrite Header set to T (overwrite).
When several files are uploaded (method is called several times), some requests fail with a 409 Conflict HTTP error.
I've googled, and it seems the most common reason is trying to affect/update a file that does not exist (like setting the request URL to a path without a file name). However, that is not the case. In case the conflict had something to do with the file already existing, I added code to physically delete the file before uploading it, and i'm still getting some 409's.
Has anyone received this type of error, and if so, can you tell me how you fixed it and what was the root cause? Any help is greatly appreciated. Thanks
This question is related to
.net
sharepoint
httpwebrequest
webrequest
I encountered similar issue when uploading a file returned 409.
Besides issues mentioned above it can also happen due to file size restrictions for POST on the server side. For example, tomcat (java web server) have POST size limit of 2MB by default.
Its because of wrong path provided. It may be that the url contains space and if the case url has to be properly constructed.
The correct url should be in the format with file name included like "http://server name/document library name/new file name"
So if report.xlsx is the file that has to be uploaded at "http://server name/Team/Dev Team" then path comes out to be is "http://server name/Team/Dev Team/report.xlsx". It contains space so it should be reconstructed as "http://server name/Team/Dev%20Team/report.xlsx" and should be used.
At times the error code 409
occurs when you name you folder or files a reserved or blocked name. These could be names like register
, contact
In my case I named a folder contact
, turns out the name was blocked from being used as folder names.
When testing my script on postman
, I was getting this error:
<script>
document.cookie = "humans_21909=1"; document.location.reload(true)
</script>
I changed the folder name from contact to contacts and it worked. The error was gone.
I found 2 things worth mentioning while uploading files using webdav and http web request. First, for the provider I was using, I had to append the filename at the end of the provider url. Ihad to append the port number in the url. And I also set the Request method to PUT instead of POST.
example:
string webdavUrl = "https://localhost:443/downloads/test.pdf";
request.Method = "PUT";
I got this error when tried to create folder http://localhost:8080/repository/default/parent/newFolder when http://localhost:8080/repository/default/parent didn't exist.
We are also getting the same error while we are trying to access a same resource with in milliseconds. Like if i try to POST
some data to www.abc.com/blog
and with in milliseconds an other request will also go for the same resource i.e. www.abc.com/blog
from the same user. So it'll give the 409
error.
I is because you are using predefined variables to naming your filename. change your filename from e.g register.asp to registerUser.asp. That will solve your issue
Source: Stackoverflow.com