none
Extended Properties using WEBDAV Exchange 2003

    Question

  • Hi,

    Our company is going to be migrating from Exchange 2003 to 2010 soon. As part of this migration I need to rewrite a number of client apps written in c# that use WebDev to update/create appointments in Exchange, and get them to use EWS instead.

    I have a c# console app that is run overnight and updates a bunch of appointments in Exchange based on data that is contained in a SQL database. Previously the ID of the record in the database was used to create/update the appointments using the URL 

    http://mymailserver/exchange/username/calendar/12345.em

    where 12345 would be the ID from the database.

    I want to move away from doing this to using extended properties once we have migrated to 2010 and updated the c# app to use EWS.

    In order to facilitate this process I need to be able to create an extended property called VisitID where I will stored the ID from the database in.

    I have managed to do this using EWS but I need to this using WEBDAV, as I need to update all existing appointments that are on Exchange 2003, before the migration occurs.

    My original app uses this as a basis for adding/updating appointments : http://msdn.microsoft.com/library/office/ms877306(v=exchg.65).aspx

    Has anyone got sample code of adding an extended property using a WEBDAV call as that would really help me!

    Friday, November 08, 2013 2:52 PM

Answers

  • To add an Extended property (or any property) in WebDAV you need to use the PropPatch method. If you wanted to be able to read this property in EWS easily then using the Public_Strings Propset  http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ which is equal to  DefaultExtendedPropertySet.PublicStrings in EWS

    eg in WebDAV something like

    sDestinationURL = "https//.../..eml"
    xmlstr = "<?xml version=""1.0"" ?><a:propertyupdate xmlns:a=""DAV:"" xmlns:b=""urn:schemas-microsoft-com:datatypes"" 
    " _
    & "xmlns:c=""xml:"" xmlns:d=""http://schemas.microsoft.com/mapi/proptag/"" " _
    & "xmlns:e=""http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/"" xmlns:f=""http://schemas.microsoft.com/exchange/""> 
    " _
    & "<a:set><a:prop>" _
    & "<e:YourPropName>Value</e:YourPropName>" _
    & "</a:prop></a:set></a:propertyupdate>"
    Set XMLreq = CreateObject("Microsoft.xmlhttp")
    XMLreq.open "PROPPATCH", sDestinationURL, False
    XMLreq.setRequestHeader "Content-Type", "text/xml;"
    XMLreq.setRequestHeader "Translate", "f"
    XMLreq.setRequestHeader "Content-Length:", Len(xmlstr)
    XMLreq.send(xmlstr)
    If (XMLreq.Status >= 200 And XMLreq.Status < 300) Then
    Wscript.echo "Success! " & "Results = " & XMLreq.Status & ": " & 
    XMLreq.statusText
    ElseIf XMLreq.Status = 401 then
    Wscript.echo "You don't have permission to do the job! Please check your 
    permissions on this item."
    Else
    Wscript.echo "Request Failed. Results = " & XMLreq.Status & ": " & 
    XMLreq.statusText
    End If

    Cheers
    Glen

    • Marked as answer by AssurityC Thursday, November 14, 2013 10:25 AM
    Monday, November 11, 2013 1:14 AM

All replies

  • To add an Extended property (or any property) in WebDAV you need to use the PropPatch method. If you wanted to be able to read this property in EWS easily then using the Public_Strings Propset  http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/ which is equal to  DefaultExtendedPropertySet.PublicStrings in EWS

    eg in WebDAV something like

    sDestinationURL = "https//.../..eml"
    xmlstr = "<?xml version=""1.0"" ?><a:propertyupdate xmlns:a=""DAV:"" xmlns:b=""urn:schemas-microsoft-com:datatypes"" 
    " _
    & "xmlns:c=""xml:"" xmlns:d=""http://schemas.microsoft.com/mapi/proptag/"" " _
    & "xmlns:e=""http://schemas.microsoft.com/mapi/string/{00020329-0000-0000-C000-000000000046}/"" xmlns:f=""http://schemas.microsoft.com/exchange/""> 
    " _
    & "<a:set><a:prop>" _
    & "<e:YourPropName>Value</e:YourPropName>" _
    & "</a:prop></a:set></a:propertyupdate>"
    Set XMLreq = CreateObject("Microsoft.xmlhttp")
    XMLreq.open "PROPPATCH", sDestinationURL, False
    XMLreq.setRequestHeader "Content-Type", "text/xml;"
    XMLreq.setRequestHeader "Translate", "f"
    XMLreq.setRequestHeader "Content-Length:", Len(xmlstr)
    XMLreq.send(xmlstr)
    If (XMLreq.Status >= 200 And XMLreq.Status < 300) Then
    Wscript.echo "Success! " & "Results = " & XMLreq.Status & ": " & 
    XMLreq.statusText
    ElseIf XMLreq.Status = 401 then
    Wscript.echo "You don't have permission to do the job! Please check your 
    permissions on this item."
    Else
    Wscript.echo "Request Failed. Results = " & XMLreq.Status & ": " & 
    XMLreq.statusText
    End If

    Cheers
    Glen

    • Marked as answer by AssurityC Thursday, November 14, 2013 10:25 AM
    Monday, November 11, 2013 1:14 AM
  • Hi Glen,

    Apologies for the late reply. After some messing around I managed to update my application based on the example you provided.

    Thanks!

    Chris

    Thursday, November 14, 2013 10:25 AM