开发者

Sample code for WebDAV PROPFIND

Is there any site or some one can provide me a sample PROFIND request please.

I tried the PROFIND code sample from MSDN but getting 400 Bad request.

Unable to understand why this is happening.

Previously posted the question at Getting 400 Bad request from WebDav Server

Any suggestions will be greatly helpfull.

Edit

@Julian,

Have updated my request body to the following:

 strBody = "<?xml version='1.0' encoding='utf-8'?>"
                 + "<propfind xmlns='DAV:'>"
                 + "<allprop/>"
                + "</propfind>";

as explained at RFC 4918, Section 9.1

But I am still gett开发者_C百科ing the 400 Bad request Error. M I missing any Headers . Please suggest I am setting the following Header Information:

 System.Net.HttpWebRequest Request;
 Request.Credentials = MyCredentialCache;
 Request.Method = "PROPFIND";

 bytes = Encoding.UTF8.GetBytes((string)strBody);
 Request.ContentType = "text/xml";

Do I need to set or specify something additional. The full code is in my Previosu Question.

Thanks,

Subhen


Ok I was missing the Depth Header and for that reason the webserver was returning Method Not allowed error.

MSDN clearlystates that A PROPFIND with depth value of "infinity" is not supported in the public store that is accessible to MAPI clients such as Microsoft Outlook.

And the Bad request 404 error was generated because I was not using proxy. So What I did I commented the line which was not using any proxy and added the Depth Header.

 // Request.Proxy = GlobalProxySelection.GetEmptyWebProxy();
Request.Headers.Add("Depth", "1");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜