tags:

views:

71

answers:

1

Hi, 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 http://stackoverflow.com/questions/3132746/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 getting 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

A: 

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");

The complete C# code can be found here

Subhen