Problem in setting Public Folder properties using WebDav

Posted on 2009-04-18
Last Modified: 2013-12-06

I have successfully created Public Folder using WebDav "MKCOL" method but I have been facing problems in setting its properties. I just want to make created public folder as mail enabled and want to set its smtp address but I don't know though return status is success - 207 Multi Status of my given code,  it doesn't set mail enabled property and hence also doesn't set smtp address. Could anyone please help me on this. It would be much appreciated.

private static bool setFolderProperties(string pfPath, string mailEnable, string smtpAddress)




                byte[] bytes = null;

                System.IO.Stream RequestStream = null;

                StringBuilder result = new StringBuilder("<?xml version=\"1.0\"?>");

                result.Append("<a:propertyupdate ")

                       .Append("xmlns:a=\"DAV:\" ")

                       .Append("xmlns:e=\"\" ")

                       .Append("xmlns:b=\"urn:schemas-microsoft-com:datatypes\" ")





                       .Append("<p:0x3FE6000B b:dt=\"boolean\">1</p:0x3FE6000B>")

                       .Append("<p:0x671F000B b:dt=\"boolean\">1</p:0x671F000B>")

                       .Append("<e:publicfolderemailaddress>" + smtpAddress + "</e:publicfolderemailaddress>")



                Console.WriteLine("Properties:\n " + (string)result.ToString());

                System.Uri pfUri = new System.Uri(pfPath);

                // Create the HttpWebRequest object.

                WebRequest Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(pfUri);

                Request.Credentials = CredentialCache.DefaultCredentials;

                Request.Method = "PROPPATCH";

                Request.ContentType = "text/xml";

                Request.ContentLength = result.Length;

                Request.Headers.Add("Translate", "f");

                // Encode the body using UTF-8.

                bytes = Encoding.UTF8.GetBytes((string)result.ToString());

                // Set the content header length.  This must be

                // done before writing data to the request stream.

                Request.ContentLength = bytes.Length;

                // Get a reference to the request stream.

                RequestStream = Request.GetRequestStream();

                // Write the message body to the request stream.

                RequestStream.Write(bytes, 0, bytes.Length);

                // Close the Stream object to release the connection

                // for further use.


                // Get the response from the server.

                // Expected response: 207 Multi-Status - HTTP_MULTI_STATUS  - The action was successfully received, understood, 

                // and accepted. Indicates that the clients request was successfully received, understood, and accepted.

                WebResponse Response = Request.GetResponse();

                Console.WriteLine("Status(Property settings): " + ((HttpWebResponse)Response).StatusCode + " : " + ((HttpWebResponse)Response).StatusDescription);



            catch (Exception ex)


                Console.WriteLine("Exception while setting properties: " + ex.Message);

                Console.WriteLine("Stack Trace: " + ex.StackTrace);

                return false;


            return true;


Open in new window

Question by:deshaw
    1 Comment
    LVL 1

    Accepted Solution

    This problem has been solved by getting rid of
     .Append("<e:publicfolderemailaddress>" + smtpAddress + "</e:publicfolderemailaddress>")

    We cannot set email address using WebDav. for that we have to use CDOEX or ADSI.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Are end users causing IT problems again?

    You’ve taken the time to design and update all your end user’s email signatures, only to find out they’re messing up the HTML, changing the font and ruining the imagery. What can you do to prevent this? Find out how you can save your signatures from end users today.

    Email statistics and Mailbox database quotas You might have an interest in attaining information such as mailbox details, mailbox statistics and mailbox database details from Exchange server. At that point, knowing how to retrieve this information …
    To show how to create a transport rule in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Rules tab.:  To cr…
    To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now