Microsoft KB Archive/308373

= How to send a meeting request by using WebDAV =

Article ID: 308373

Article Last Modified on 9/12/2005

-

APPLIES TO


 * Microsoft Exchange 2000 Server Standard Edition
 * Microsoft Exchange Server 2003 Standard Edition
 * Microsoft Exchange Server 2003 Enterprise Edition
 * Microsoft XML Parser 2.0
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Professional Edition

-



This article was previously published under Q308373



SUMMARY
This article contains sample code that demonstrates how to send a meeting request using Web Distributed Authoring and Versioning (WebDAV).



MORE INFORMATION
To send a meeting request with WebDAV, a meeting request associated appointment item and a meeting request message must be created using the PROPPATCH verb. The meeting request associated appointment item is created first in the meeting organizer's Calendar folder. This appointment contains a urn:schemas:calendar:uid property. The meeting request message is created in the meeting organizer's Calendar folder as well, with the same value for urn:schemas:calendar:uid as in the meeting associated appointment item. The meeting request message is then moved to the meeting organizer's mail submission URI using the MOVE verb to submit the meeting request to all attendees.

To use this code sample, follow these steps:  In Visual Basic, create a new Standard EXE project. Add a button to the default form and name it &quot;SendRequest&quot;.  Paste the following code into the view code window: Private Sub SendRequest_Click Dim strApptURL As String Dim strMeetingURL As String Dim strSubmissionURL As String Dim strExServer As String Dim strMailbox As String Dim strFolder As String Dim strApptItem As String Dim strMeetingItem As String Dim strPassWord As String Dim strXMLNSInfo As String Dim strApptRequest As String Dim strUIDRequest As String Dim strUID As String Dim bResult As Boolean ' TODO: Replace with your server name. strExServer = &quot;MyServer&quot; ' TODO: Replace with your mailbox name. strMailbox = &quot;Administrator&quot; strFolder = &quot;Calendar&quot; strApptItem = &quot;meetappt.eml&quot; strMeetingItem = &quot;meetappt2.eml&quot; strPassWord = &quot;password&quot;

strApptURL = &quot;http://&quot; & strExServer & &quot;/exchange/&quot; & _ strMailbox & &quot;/&quot; & strFolder & &quot;/&quot; & strApptItem strMeetingURL = &quot;http://&quot; & strExServer & &quot;/exchange/&quot; & _ strMailbox & &quot;/&quot; & strFolder & &quot;/&quot; & strMeetingItem strSubmissionURL = &quot;http://&quot; & strExServer & &quot;/exchange/&quot; & _ strMailbox & &quot;/##DavMailSubmissionURI##/&quot; strXMLNSInfo = &quot;xmlns:g=&quot;&quot;DAV:&quot;&quot; &quot; & _ &quot;xmlns:e=&quot;&quot;http://schemas.microsoft.com/exchange/&quot;&quot; &quot; & _ &quot;xmlns:mapi=&quot;&quot;http://schemas.microsoft.com/mapi/&quot;&quot; &quot; & _ &quot;xmlns:mapit=&quot;&quot;http://schemas.microsoft.com/mapi/proptag/&quot;&quot; &quot; & _ &quot;xmlns:x=&quot;&quot;xml:&quot;&quot; xmlns:cal=&quot;&quot;urn:schemas:calendar:&quot;&quot; &quot; & _ &quot;xmlns:dt=&quot;&quot;urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/&quot;&quot; &quot; & _ &quot;xmlns:header=&quot;&quot;urn:schemas:mailheader:&quot;&quot; &quot; & _ &quot;xmlns:mail=&quot;&quot;urn:schemas:httpmail:&quot;&quot;>&quot; ' Calendar item properties. strCalInfo = &quot;meetappt Location&quot; & _ &quot;2001-09-22T22:00:00.000Z&quot; & _ &quot;2001-09-22T22:30:00.000Z&quot; & _ &quot;0</cal:instancetype>&quot; & _ &quot;<cal:busystatus>BUSY</cal:busystatus>&quot; & _ &quot;<cal:meetingstatus>CONFIRMED</cal:meetingstatus>&quot; & _ &quot;<cal:alldayevent dt:dt=&quot;&quot;boolean&quot;&quot;>0</cal:alldayevent>&quot; & _ &quot;<cal:responserequested dt:dt=&quot;&quot;boolean&quot;&quot;>1</cal:responserequested>&quot; ' urn:schemas:mailheader:to Required Attendee ' urn:schemas:mailheader:cc Optional Attendee ' urn:schemas:mailheader:bcc Resource ' TODO: Replace the value to fit your environment. strHeaderInfo = &quot;<header:to>user1@here.microsoft.com</header:to>&quot; & _ &quot;<header:cc>user2@here.microsoft.com</header:cc>&quot; & _ &quot;<header:bcc>user3@here.microsoft.com</header:bcc>&quot; strMailInfo = &quot;<mail:subject>meetappt Subject</mail:subject>&quot; & _ &quot;<mail:htmldescription>Let's meet here</mail:htmldescription>&quot;

strApptRequest = &quot;<?xml version=&quot;&quot;1.0&quot;&quot;?>&quot; & _ &quot;<g:propertyupdate &quot; & strXMLNSInfo & _ &quot;<g:set>&quot; & _ &quot;<g:prop>&quot; & _ &quot;<g:contentclass>urn:content-classes:appointment</g:contentclass>&quot; & _ &quot;<e:outlookmessageclass>IPM.Appointment</e:outlookmessageclass>&quot; & _ strMailInfo & _ strCalInfo & _ strHeaderInfo & _ &quot;<mapi:finvited dt:dt=&quot;&quot;boolean&quot;&quot;>1</mapi:finvited>&quot; & _ &quot;</g:prop>&quot; & _ &quot;</g:set>&quot; & _ &quot;</g:propertyupdate>&quot; bResult = False

' Create meeting associated appointment in calendar. bResult = CreateMeetingAppointment(strApptURL, _           strApptRequest, _            strMailbox, _            strPassWord) If bResult Then MsgBox &quot;Successfully create the meeting appointment!&quot; strUIDRequest = &quot;<?xml version='1.0'?>&quot; & _ &quot;<a:propfind xmlns:a='DAV:'>&quot; & _ &quot;<a:prop xmlns:uid='urn:schemas:calendar:'>&quot; & _ &quot;<uid:uid/>&quot; & _ &quot;</a:prop>&quot; & _ &quot;</a:propfind>&quot;

' urn:schemas:calendar:uid needs to be copied over to meeting request. strUID = FindAppointmentUID(strApptURL, _          strUIDRequest, _           strMailbox, _           strPassWord) If strUID <> &quot;&quot; Then bResult = False ' Meeting request item properties. ' TODO: Replace the value to fit your environment. strCCInfo = &quot;<g:contentclass>urn:content-classes:calendarmessage</g:contentclass>&quot; & _ &quot;<e:outlookmessageclass>IPM.Schedule.Meeting.Request</e:outlookmessageclass>&quot; strMapiInfo = &quot;<mapi:finvited dt:dt=&quot;&quot;boolean&quot;&quot;>1</mapi:finvited>&quot; & _ &quot;<mapi:responsestatus dt:dt=&quot;&quot;int&quot;&quot;>1</mapi:responsestatus>&quot; & _ &quot;<mapi:responsestate dt:dt=&quot;&quot;int&quot;&quot;>0</mapi:responsestate>&quot; & _ &quot;<mapi:response_requested dt:dt=&quot;&quot;boolean&quot;&quot;>1</mapi:response_requested>&quot; & _ &quot;<mapi:apptstateflags dt:dt=&quot;&quot;int&quot;&quot;>3</mapi:apptstateflags>&quot; & _ &quot;<mapi:busystatus dt:dt=&quot;&quot;int&quot;&quot;>1</mapi:busystatus>&quot; & _ &quot;<mapi:intendedbusystatus dt:dt=&quot;&quot;int&quot;&quot;>2</mapi:intendedbusystatus>&quot; strMeetingRequest = &quot;<?xml version=&quot;&quot;1.0&quot;&quot;?>&quot; & _ &quot;<g:propertyupdate &quot; & strXMLNSInfo & _ &quot;<g:set>&quot; & _ &quot;<g:prop>&quot; & _ strCCInfo & _ strMailInfo & _ strCalInfo & &quot;<cal:uid>&quot; & strUID & &quot;</cal:uid>&quot; & _ strHeaderInfo & _ strMapiInfo & _ &quot;</g:prop>&quot; & _ &quot;</g:set>&quot; & _ &quot;</g:propertyupdate>&quot;

' Create meeting request item in calendar. bResult = CreateMeetingAppointment(strMeetingURL, _            strMeetingRequest, _             strMailbox, _             strPassWord) If bResult Then MsgBox &quot;Successfully create the meeting request!&quot; bResult = False

' MOVE the meeting request to mail submission URI. bResult = SubmitMeetingRequest(strMeetingURL, _            strSubmissionURL, _             strMailbox, _             strPassWord) If bResult Then MsgBox &quot;Successfully send the meeting request!&quot; End If End If ' end bResult is TRUE for creating meeting request End If ' end strUID <> &quot;&quot; End If ' end bResult is TRUE for creating meeting appt End Sub

Function CreateMeetingAppointment( _ strURL, _ strApptRequest, _ strUserName, _ strPassWord) As Boolean Dim xmlReq As MSXML.XMLHTTPRequest On Error GoTo ErrHandler ' Create the DAV PROPPATCH request. Set xmlReq = CreateObject(&quot;Microsoft.XMLHTTP&quot;) xmlReq.open &quot;PROPPATCH&quot;, strURL, False, strUserName, strPassWord xmlReq.setRequestHeader &quot;Content-Type&quot;, &quot;text/xml&quot; xmlReq.send strApptRequest

' Process the results. If (xmlReq.Status >= 200 And xmlReq.Status < 300) Then MsgBox &quot;Success! PROPPATCH Results = &quot; & xmlReq.Status & _ &quot;: &quot; & xmlReq.statusText CreateMeetingAppointment = True Else MsgBox &quot;Request Failed. PROPPATCH Results = &quot; & xmlReq.Status & _ &quot;: &quot; & xmlReq.statusText CreateMeetingAppointment = False End If ErrExit: Set xmlReq = Nothing Exit Function ErrHandler: MsgBox Err.Number & &quot;: &quot; & Err.Description CreateMeetingAppointment = False End Function

Function FindAppointmentUID( _ strURL, _ strUIDRequest, _ strUserName, _ strPassWord) As String Dim xmlReq As MSXML.XMLHTTPRequest Dim xmldom As MSXML.DOMDocument Dim xmlRoot As MSXML.IXMLDOMElement Dim xmlNode As MSXML.IXMLDOMNode Dim xmlAttr As MSXML.IXMLDOMAttribute Dim baseName As String On Error GoTo ErrHandler ' Create the DAV PROPFIND request. Set xmlReq = CreateObject(&quot;Microsoft.XMLHTTP&quot;) xmlReq.open &quot;PROPFIND&quot;, strURL, False, strUserName, strPassWord xmlReq.setRequestHeader &quot;Content-Type&quot;, &quot;text/xml&quot; xmlReq.setRequestHeader &quot;Depth&quot;, &quot;0&quot; xmlReq.send (strUIDRequest) ' Process the result. If (xmlReq.Status >= 200 And xmlReq.Status < 300) Then MsgBox &quot;Success! &quot; & &quot;PROPFIND Results = &quot; & xmlReq.Status & _ &quot;: &quot; & xmlReq.statusText Set xmldom = xmlReq.responseXML Set xmlRoot = xmldom.documentElement For Each xmlAttr In xmlRoot.Attributes If xmlAttr.Text = &quot;urn:schemas:calendar:&quot; Then baseName = xmlAttr.baseName Exit For End If   Next Set xmlNode = xmlRoot.selectSingleNode(&quot;//&quot; & baseName & &quot;:uid&quot;) FindAppointmentUID = xmlNode.Text Else MsgBox &quot;Failed to find Appointment UID&quot; FindAppointmentUID = &quot;&quot; End If ErrExit: Set xmlReq = Nothing Set xmldom = Nothing Set xmlRoot = Nothing Set xmlNode = Nothing Set xmlAttr = Nothing Exit Function ErrHandler: MsgBox Err.Number & &quot;: &quot; & Err.Description FindAppointmentUID = &quot;&quot;

End Function Function SubmitMeetingRequest( _ strSrcURL, _ strSubmissionURL, _ strUserName, _ strPassWord) As Boolean Dim xmlReq As MSXML.XMLHTTPRequest On Error GoTo ErrHandler Set xmlReq = CreateObject(&quot;Microsoft.xmlhttp&quot;) xmlReq.open &quot;MOVE&quot;, strSrcURL, False, strUserName, strPassWord xmlReq.setRequestHeader &quot;Destination&quot;, strSubmissionURL xmlReq.setRequestHeader &quot;Content-Type&quot;, &quot;message/rfc822&quot; xmlReq.send ' Display the results. If (xmlReq.Status >= 200 And xmlReq.Status < 300) Then MsgBox &quot;Success! &quot; & &quot;Results = &quot; & xmlReq.Status & &quot;: &quot; & xmlReq.statusText SubmitMeetingRequest = True ElseIf xmlReq.Status = 401 Then SubmitMeetingRequest = False MsgBox &quot;You don't have permission to do the job! Please check your permissions on this item.&quot; Else SubmitMeetingRequest = False MsgBox &quot;Request Failed. Results = &quot; & xmlReq.Status & &quot;: &quot; & xmlReq.statusText End If ErrExit: Set xmlReq = Nothing Exit Function ErrHandler: MsgBox Err.Number & &quot;: &quot; & Err.Description SubmitMeetingRequest = False End Function </li> Make the appropriate changes to the code for your environment.</li> Add a reference to Microsoft XML version 2.0 Library.</li> Run the program, and then click the button.</li> From Outlook, open the meeting request items in the attendees' Inbox folders, and respond to the meeting requests.</li> Open the meeting response messages in the organizer's Inbox folder.</li> Open the original appointment item in the organizer's Calendar folder, and verify that the tracking information reflects the responses.</li></ol>

Additional query words: meeting request

Keywords: kbhowto kbmsg KB308373

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.