Re: Web DAV only works when authenticated to OWA

From: Lee Derbyshire [MVP] (a_at_t)
Date: 08/20/04

  • Next message: Tom Rizzo [MSFT]: "Re: Items IDs in the Exchange Store"
    Date: Fri, 20 Aug 2004 20:32:52 +0100
    
    

    Is that your real password in that code? If so, I suggest you
    change it soon :) . Anyway, try using "DOMAINNAME\gary" ,
    instead of just "gary" (where DOMAINNAME is replaced by your
    ~real~ domain name, of course).

    Lee.

    -- 
    _______________________________________
    Outlook Web Access For PDA , OWA For WAP:
    www.leederbyshire.com
    email a@t leederbyshire d.0.t c.0.m
    _______________________________________
    "Gary" <gary9710@yahoo.com> wrote in message 
    news:434eeef1.0408200919.4ab5d8db@posting.google.com...
    >I have an ASP page on a remote server that creates a contact as 
    >long
    > as I am logged into OWA. If I logout of OWA I get a syntax 
    > error on
    > the line: objRequest.send strBody
    >
    > I want to have a remote web page update contact records with 
    > Web DAV
    > but not have to be logged into OWA. Can this be done?
    >
    > here is the link to the msdn article I used:
    > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/e2k3/e2k3/_exch2k_creating_a_contact_webdav.asp
    >
    > Here is the code I use:
    > Sub CreateContact_click()
    >
    > ' Declare variables to be used.
    >    Dim objRequest 'As MSXML.XMLHTTPRequest
    >    Dim strBody 'As String
    >    Dim strXMLNSInfo 'As String
    >    Dim strNameInfo 'As String
    >    Dim strBusinessAddrInfo 'As String
    >    Dim strHomeAddrInfo 'As String
    >    Dim strOtherAddrInfo 'As String
    >    Dim strMailAddrInfo 'As String
    >    Dim strPhoneInfo 'As String
    >    Dim strEmailInfo 'As String
    >    Dim strOrganizationalInfo 'As String
    >    Dim strPersonalInfo 'As String
    >    Dim strCustomerInfo 'As String
    >    Dim strFollowUpInfo 'As String
    >    Dim strMiscInfo 'As String
    >    Dim strUserFieldsInfo 'As String
    >    Dim strURL 'As String
    >
    >    ' Specify the URL of the new object to be created.
    >    strURL = 
    > "http://myserver/public/WorkArea/Gary/Contacts/JohnDoe.eml"
    >    ' Create an HTTP request object.
    >    Set objRequest = CreateObject("Microsoft.xmlhttp")
    >  'alert typename(objRequest)
    >    ' Specify the Namespaces to be used.
    >    strXMLNSInfo = "xmlns:g=""DAV:"" " & _
    >        "xmlns:c=""urn:schemas:contacts:"" " & _
    >        "xmlns:e=""http://schemas.microsoft.com/exchange/"" " & 
    > _
    >        "xmlns:mapi=""http://schemas.microsoft.com/mapi/"" " & _
    >        "xmlns:x=""xml:"" xmlns:cal=""urn:schemas:calendar:"" " 
    > & _
    >        "xmlns:mail=""urn:schemas:httpmail:"">"
    >    ' Specify the contact's name information.
    >    ' (First Name, Middle Name, Last Name, Full Name,
    >    '  Subject of the contact--used by Outlook Address Book,
    >    '  File As, Initials, Nickname, Title, and Suffix)
    >    strNameInfo = "<c:givenName>John</c:givenName>" & _
    >        "<c:middlename>Jacob</c:middlename>" & _
    >        "<c:sn>Doe</c:sn>" & _
    >        "<c:cn>John J. Doe</c:cn>" & _
    >        "<mail:subject>John Doe</mail:subject>" & _
    >        "<c:fileas>Doe, John</c:fileas>" & _
    >        "<c:initials>JJD</c:initials>" & _
    >        "<c:nickname>Johnnie</c:nickname>" & _
    >        "<c:personaltitle>Mr.</c:personaltitle>" & _
    >        "<c:namesuffix>MCSD</c:namesuffix>"
    >    ' Specify the Business Address Information.
    >    ' (Street, PO Box, City, State, Postal Code, and Country)
    >    strBusinessAddrInfo = "<c:street>One Microsoft 
    > Way</c:street>" & _
    >        "<c:postofficebox>PO Box 12345</c:postofficebox>" & _
    >        "<c:l>Redmond</c:l>" & _
    >        "<c:st>WA</c:st>" & _
    >        "<c:postalcode>98052-6399</c:postalcode>" & _
    >        "<c:co>USA</c:co>"
    >    ' Specify the Home Address Information.
    >    ' (Street, PO Box, City, State, Postal Code, and Country)
    >    strHomeAddrInfo = "<c:homeStreet>500 Main 
    > Street</c:homeStreet>" &
    > _
    >        "<c:homepostofficebox>PO Box 
    > 54321</c:homepostofficebox>" & _
    >        "<c:homeCity>Bellevue</c:homeCity>" & _
    >        "<c:homeState>WA</c:homeState>" & _
    >        "<c:homePostalCode>98004</c:homePostalCode>" & _
    >        "<c:homeCountry>USA</c:homeCountry>"
    >    ' Specify the Other Address Information.
    >    ' (Street, PO Box, City, State, Postal Code, and Country)
    >    strOtherAddrInfo = "<c:otherstreet>99 Myrtle 
    > Ave</c:otherstreet>"
    > & _
    >        "<c:otherpostofficebox>PO Box 
    > 98765</c:otherpostofficebox>" &
    > _
    >        "<c:othercity>Green Cove Springs</c:othercity>" & _
    >        "<c:otherstate>FL</c:otherstate>" & _
    >        "<c:otherpostalcode>32043</c:otherpostalcode>" & _
    >        "<c:othercountry>USA</c:othercountry>"
    >    ' Specify which address is the mailing address.
    >    ' 0 = None, 1 = Home, 2 = Business, 3 = Other
    >    strMailAddrInfo = 
    > "<c:mailingaddressid>2</c:mailingaddressid>"
    >    ' Specify phone number information.
    >    ' (Business Phone, Business Phone 2, Business Fax,
    >    '  Home Phone, Home Phone 2, Home Fax,
    >    '  Other Phone, Other Fax, Pager, Mobile Phone,
    >    '  Car Phone, ISDN, Telex, TTY/TDD, Callback)
    >    strPhoneInfo = 
    > "<c:telephoneNumber>425-555-1110</c:telephoneNumber>"
    > & _
    >        "<c:telephonenumber2>425-555-1111</c:telephonenumber2>" 
    > & _
    > 
    > "<c:facsimiletelephonenumber>425-555-1112</c:facsimiletelephonenumber>"
    > & _
    >        "<c:homePhone>425-555-1113</c:homePhone>" & _
    >        "<c:homephone2>425-555-1114</c:homephone2>" & _
    >        "<c:homefax>425-555-1115</c:homefax>" & _
    >        "<c:otherTelephone>904-555-1111</c:otherTelephone>" & _
    >        "<c:otherfax>904-555-1112</c:otherfax>" & _
    >        "<c:pager>425-555-1116</c:pager>" & _
    >        "<c:mobile>425-555-1117</c:mobile>" & _
    >        "<c:othermobile>904-555-1113</c:othermobile>" & _
    > 
    > "<c:internationalisdnnumber>425-555-1118</c:internationalisdnnumber>"
    > & _
    >        "<c:telexnumber>425-555-1119</c:telexnumber>" & _
    >        "<c:ttytddphone>425-555-1120</c:ttytddphone>" & _
    >        "<c:callbackphone>425-555-1121</c:callbackphone>"
    >    ' Specify the e-mail address information.
    >    strEmailInfo = "<mapi:emaillisttype>1</mapi:emaillisttype>" 
    > & _
    >        "<mapi:email1addrtype>EX</mapi:email1addrtype>" & _
    >        "<mapi:email1emailaddress>" & _
    >            "/o=Microsoft/ou=First Administrative
    > Group/cn=Recipients/cn=jdoe" & _
    >            "</mapi:email1emailaddress>" & _
    >        "<mapi:email1originaldisplayname>" & _
    >            "John Doe (Exchange)" & _
    >            "</mapi:email1originaldisplayname>" & _
    >        "<mapi:email2addrtype>SMTP</mapi:email2addrtype>" & _
    >        "<mapi:email2emailaddress>" & _
    >            "john.doe@whatever.domain.com" & _
    >            "</mapi:email2emailaddress>" & _
    >        "<mapi:email2originaldisplayname>" & _
    >            "John Doe (SMTP)" & _
    >            "</mapi:email2originaldisplayname>" & _
    >        "<mapi:email3addrtype>X400</mapi:email3addrtype>" & _
    >        "<mapi:email3emailaddress>" & _
    >            "c=us;a= ;p=Microsoft;o=Exchange;s=Doe;g=John;i=J;" 
    > & _
    >            "</mapi:email3emailaddress>" & _
    >        "<mapi:email3originaldisplayname>" & _
    >            "John Doe (X400)" & _
    >            "</mapi:email3originaldisplayname>"
    >    ' Specify organizational information.
    >    ' (Company, Company Main Phone, Business Home Page,
    >    '  Department, Job Title, Manager's Name,
    >    '  Assistant's Name, Assistant's Phone, Office Location,
    >    '  Organizational ID Number, Computer Network Name,
    >    '  Profession)
    >    strOrganizationalInfo = "<c:o>Microsoft Corporation</c:o>" & 
    > _
    > 
    > "<c:organizationmainphone>425-882-8080</c:organizationmainphone>"
    > & _
    > 
    > "<c:businesshomepage>http://www.microsoft.com>"
    > & _
    >        "<c:department>YYY</c:department>" & _
    >        "<c:title>Lead Software Design Engineer</c:title>" & _
    >        "<c:manager>Ashley Doe</c:manager>" & _
    >        "<c:secretarycn>Pat Doe</c:secretarycn>" & _
    >        "<c:secretaryphone>425-555-1122</c:secretaryphone>" & _
    >        "<c:roomnumber>C-309</c:roomnumber>" & _
    >        "<c:employeenumber>987654321</c:employeenumber>" & _
    >        "<c:computernetworkname>jdoe</c:computernetworkname>" & 
    > _
    >        "<c:profession>Software Designer</c:profession>"
    >    ' Specify personal information.
    >    ' (Birthday, Anniversary, Spouse, Children, Gender,
    >    '  Personal Home Page, Hobbies)
    >    strPersonalInfo = "<c:bday>1974-01-01T08:00:00Z</c:bday>" & 
    > _
    > 
    > "<c:weddinganniversary>1995-01-01T08:00:00Z</c:weddinganniversary>"
    > & _
    >        "<c:spousecn>Jane Doe</c:spousecn>" & _
    >        "<c:childrensnames>" & _
    >            "<x:v>Ellen Doe</x:v><x:v>Grace Doe</x:v>" & _
    >            "</c:childrensnames>" & _
    >        "<c:gender>Male</c:gender>" & _
    >        "<c:personalHomePage>" & _
    >            "http://www.homepagedomain.com/JohnDoe/default.htm" 
    > & _
    >            "</c:personalHomePage>" & _
    >        "<c:hobbies>Playing XBox games,Watching
    > UltimateTV</c:hobbies>"
    >    ' Specify customer related information.
    >    ' (Customer ID, Account, Billing Information)
    >    strCustomerInfo = "<c:customerid>YYY</c:customerid>" & _
    >        "<c:account>YYY</c:account>" & _
    >        "<c:billinginformation>YYY</c:billinginformation>"
    >    ' Specify Follow Up/Reminder information.
    >    ' (Reminder, Reminder Topic, Reminder Time, etc.)
    >    strFollowUpInfo = "<mapi:reminderset>1</mapi:reminderset>" & 
    > _
    >        "<mapi:request>Call</mapi:request>" & _
    > 
    > "<mapi:remindertime>2001-12-01T08:00:00Z</mapi:remindertime>"
    > & _
    > 
    > "<mapi:remindernexttime>2001-12-01T08:00:00Z</mapi:remindernexttime>"
    > & _
    >        "<e:reply-by-iso>2001-12-01T08:00:00Z</e:reply-by-iso>"
    >    ' Specify miscellaneous information.
    >    ' (Categories, Contacts, Mileage, FTP Site, Language,
    >    '  Government ID, Location, Internet Free/Busy Address,
    >    '  Sensitivity)
    >    strMiscInfo = "<e:keywords-utf8>" & _
    >            "<x:v>Buddies</x:v><x:v>Engineers</x:v>" & _
    >        "</e:keywords-utf8>" & _
    >        "<mapi:contacts><x:v>Penelope Doe</x:v></mapi:contacts>" 
    > & _
    >        "<e:mileage>Rarely used string property</e:mileage>" & _
    >        "<c:ftpsite>ftp://ftp.microsoft.com/>" & _
    >        "<c:language>US English</c:language>" & _
    >        "<c:governmentid>000-00-0000</c:governmentid>" & _
    >        "<c:location>Nowhere Land</c:location>" & _
    > 
    > "<cal:fburl>http://www.homepagedomain.com/JohnDoe/freebusy>"
    > & _
    >        "<mapi:sensitivity>2</mapi:sensitivity>"
    >    ' Specify User Field information.
    >    ' (User Field 1, User Field 2, User Field 3, User Field 4)
    >    strUserFieldsInfo = "<e:extensionattribute1>User Data 1" & _
    >            "</e:extensionattribute1>" & _
    >        "<e:extensionattribute2>User Data 
    > 2</e:extensionattribute2>" &
    > _
    >        "<e:extensionattribute3>User Data 
    > 3</e:extensionattribute3>" &
    > _
    >        "<e:extensionattribute4>User Data 
    > 4</e:extensionattribute4>"
    >
    >    ' Put it all together in an HTTP request.
    >    strBody = "<?xml version=""1.0""?>" & _
    >        "<g:propertyupdate " & strXMLNSInfo & _
    >            "<g:set>" & _
    >                "<g:prop>" & _
    > 
    > "<g:contentclass>urn:content-classes:person</g:contentclass>"
    > & _
    > 
    > "<e:outlookmessageclass>IPM.Contact</e:outlookmessageclass>"
    > & _
    >                    strNameInfo & strBusinessAddrInfo & _
    >                    strHomeAddrInfo & strOtherAddrInfo & _
    >                    strMailAddrInfo & strPhoneInfo & _
    >                    strEmailInfo & strOrganizationalInfo & _
    >                    strPersonalInfo & strCustomerInfo & _
    >                    strFollowUpInfo & strMiscInfo & _
    >                    strUserFieldsInfo & _
    >                "</g:prop>" & _
    >            "</g:set>" & _
    >        "</g:propertyupdate>"
    >    alert strurl
    >    ' Open the request object, assigning it the method PROPPATCH
    >    objRequest.open "PROPPATCH", strURL, False, "gary", 
    > "olympics"
    >    ' Set the necessary headers for the request.
    >    objRequest.setRequestHeader "Content-Type", "text/xml"
    >    objRequest.setRequestHeader "Translate", "f"
    >    objRequest.setRequestHeader "Content-Length", Len(strBody)
    >
    >    ' Send the request, using the XML document as the body.
    >    objRequest.send strBody
    >
    >    'Display the results.
    >    If (objRequest.Status >= 200 And objRequest.Status < 300) 
    > Then
    >        MsgBox "Success!   " & "Results = " & objRequest.Status 
    > & _
    >            ": " & objRequest.statusText
    >    ElseIf objRequest.Status = 401 Then
    >        MsgBox "You don't have permission to do the job! " & _
    >            "Please check your permissions on this item."
    >    Else
    >        MsgBox "Request Failed.  Results = " & objRequest.Status 
    > & _
    >            ": " & objRequest.statusText
    >    End If
    >
    >    Set objRequest = Nothing
    > END SUB 
    

  • Next message: Tom Rizzo [MSFT]: "Re: Items IDs in the Exchange Store"

    Relevant Pages

    • Web DAV only works when authenticated to OWA
      ... Dim objRequest 'As MSXML.XMLHTTPRequest ... Dim strXMLNSInfo 'As String ... ' Specify the URL of the new object to be created. ... ' Specify the Business Address Information. ...
      (microsoft.public.exchange.development)
    • Re: On Error GoTo is not working
      ... Dim strRequestID As String ... Dim strMessage As String ... MsgBox "Required fields for this form are: Request ID, Date, Name, ...
      (microsoft.public.access.formscoding)
    • Re: On Error GoTo is not working
      ... Dim strRequestID As String ... Dim strMessage As String ... MsgBox "Required fields for this form are: Request ID, Date, Name, ...
      (microsoft.public.access.formscoding)
    • How can I do a loop?
      ... Dim strBrief_Description As String ... strMessage = "The following requesthave been moved into production: ... "For futher details regarding this request please go to the database ...
      (microsoft.public.access.formscoding)
    • Re: On Error GoTo is not working
      ... Dim strRequestID As String ... Dim blnRequiredFieldIsMissing As Boolean ... MsgBox "Required fields for this form are: Request ID, Date, ...
      (microsoft.public.access.formscoding)