Morning All,

I am having a real ‘pulling my hair out’ time trying to get WebDav to
work from my vb.net application through to my exchange server.  My
exchange server has SSl and forms based authentication on.

When I send my request through to “http://myserver.....” , I get a
response back of “Please resubmit through a secured port”.  When I
send via “https://myserver.....” I get a 440 login timeout error.

My code is currently (with the 440 error)….

            strUserName = "MyName"
            strPassword = "Password"
            strDomain = "domain"
            strCalendarURI = "https://myserver/exchange/MyName/
calendar/"


            ' Build the SQL query.
            strQuery = "<?xml version=""1.0""?>" & _
                       "<g:searchrequest xmlns:g=""DAV:"">" & _
                       "<g:sql>SELECT
""urn:schemas:calendar:location"", ""urn:schemas:httpmail:subject"", "
& _
                       """urn:schemas:calendar:dtstart"",
""urn:schemas:calendar:dtend"", " & _
                       """urn:schemas:calendar:busystatus"",
""urn:schemas:calendar:instancetype"" " & _
                       "FROM Scope('SHALLOW TRAVERSAL OF """ &
strCalendarURI & """') " & _
                       "WHERE NOT
""urn:schemas:calendar:instancetype"" = 1 " & _
                       "AND ""DAV:contentclass"" = 'urn:content-
classes:appointment' " & _
                       "AND ""urn:schemas:calendar:dtstart"" >
'2003/06/01 00:00:00' " & _
                       "ORDER BY ""urn:schemas:calendar:dtstart"" ASC"
& _
                       "</g:sql></g:searchrequest>"

            ' Create the PUT HttpWebRequest object.
            Request = CType(System.Net.WebRequest.Create
(strCalendarURI), _
                            System.Net.HttpWebRequest)

            Dim strReusableCookies As String

            ' Create our Web request object.
            strReusableCookies = AuthenticateSecureOWA("myserver",
strDomain, strUserName, strPassword)

            ' Add the cookie set that is obtained after OWA
authentication to our request header.
            Request.Headers.Add("Cookie", strReusableCookies)
            Request.ContentType = "text/xml"
            Request.KeepAlive = True
            Request.AllowAutoRedirect = False
            ServicePointManager.CertificatePolicy = New
MyCertificateValidation

            ' Specify the SEARCH method.
            Request.Method = "SEARCH"

            ' Encode the body using UTF-8.
            bytes = System.Text.Encoding.UTF8.GetBytes(strQuery)

            ' 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()


                etc



Now, according to this web site on the subject (http://
library.gnome.org/devel/evolution-exchange/stable/ximian-connector-
fba.html), I need to do a GET without the “Translate: F” instead of
the Search otherwise the cookie is made invalid – but I need to do a
search in order to get the calendar results back.

Am I missing code between the cookie store and the ‘Request.Method =
"SEARCH"’ call?  And if so, what?

Reply via email to