WebDav PROPPATCH method status HTTP/1.1 424 Failed Dependency -
i trying access , modify properties 'creationdate' , 'lastmodified' of file have uploaded webdav url. getting response 'http/1.1 424 failed dependency' interpret 'the request failed due failure of previous request' according https://tools.ietf.org/html/rfc4918.
i lost previous request failing here, when run code don't error on it. here code:
fileinfo^ myfi=gcnew fileinfo(myfilepath); string^ mytime=myfi->lastwritetimeutc.tofiletimeutc().tostring(); string^ strbody = "<?xml version=\"1.0\"?>" + "<d:propertyupdate xmlns:d=\"dav:\">" + "<d:set>" + "<d:prop>" + "<creationdate>" + myfi->creationtimeutc.tofiletimeutc().tostring() + "</creationdate>" + "</d:prop>" + "<d:prop>" + "<lastmodified>" + mytime + "</lastmodified>" + "</d:prop>" + "</d:set>" + "</d:propertyupdate>"; array<byte>^ mybytes= encoding::utf8->getbytes(strbody); string^ responseresult=""; string^ filename= myfi->name; system::net::httpwebrequest^ httpputrequest = (system::net::httpwebrequest^)system::net::webrequest::create(this->myurl + destinationpath+ "/" + filename); httpputrequest->credentials = gcnew networkcredential(this->myusername, this->mypassword); httpputrequest->preauthenticate = true; httpputrequest->method = l"proppatch"; httpputrequest->contenttype = "text/xml"; httpputrequest->contentlength = mybytes->length; stream^ requeststream = httpputrequest->getrequeststream(); requeststream->write(mybytes,0,mybytes->length); requeststream->close(); httpwebresponse^ httpputresponse = (httpwebresponse^)httpputrequest->getresponse(); responseresult=httpputresponse->statusdescription; httpstatuscode mycode=httpputresponse->statuscode; stream^ myresponse=httpputresponse->getresponsestream(); streamreader^ myr=gcnew streamreader(myresponse); string^ res=myr->readtoend();
i have tried 1 property , have same response.
any advise, please?
it's important echo entire response. failed dependency emitted in following case:
- you doing proppatch update more 1 property
- one of properties fails (for example 403 forbidden)
- the other properties automatically 424 failed dependency, because propatch must either entirely succeed, or entirely fail.
my guess server not allow update 1 or more of properties. {dav:}lastmodified
in particular in general protected, , read-only property never allowed change. depends on server if or not allow that, in general should fail.
Comments
Post a Comment