|
|
|
date: Wed, 28 Dec 2005 12:42:02 -0800,
group: microsoft.public.exchange2000.development
back
Problem cancelling meetings - 409 Conflict Error using XmlHttp
Hello,
I'm attempting to cancel a meeting using the following code:
string messageUrl = this.GetMessageUrl(messageID);
string xmlstr = "?Cmd=delete"+
"&Action=cancel"+
"&SENDUPDATE=1"+
"&FormType=Appointment"+
"&CmdReferring=edit"+
"&Required="+
"&Optional="+
"&Resource="+
"&MsgID="+messageUrl+
"&CALENDAR="+messageUrl+
"&urn:schemas:httpmail:textdescription="+textDescription+
"&urn:schemas:httpmail:htmldescription="+htmlDescription;
xmlstr = xmlstr.Replace(":","%3A").Replace("/","%2F");
XMLHTTP xmlHttp_ = new XMLHTTP();
xmlHttp_.open("POST", messageUrl, false, user, password);
xmlHttp_.send(xmlstr);
I always receive a 409 Conflict error. How can I cancel a meeting?
If I should be using WebDav, can someone please post code that will handle
this?
Thanks,
Liz
date: Wed, 28 Dec 2005 12:42:02 -0800
author: liz-kma
Re: Problem cancelling meetings - 409 Conflict Error using XmlHttp
You can create Meeting cancellation messages simular to how you created the
invite to delete the appointment from the source mailbox you just need to
use a WebDAV delete. Meeting cancellation would look something like
server = "servername"
mailbox = "mailbox"
sDestinationURL = "http://" & server & "/exchange/" & mailbox &
"/drafts/canreq.eml"
Set XMLreq = CreateObject("Microsoft.xmlhttp")
XMLreq.open "PROPPATCH", sDestinationURL, False
xmlstr = "<?xml version=""1.0""?>" _
& "<g:propertyupdate " _
& " xmlns:g=""DAV:"" xmlns:e=""http://schemas.microsoft.com/exchange/"""
_
& " xmlns:mapi=""http://schemas.microsoft.com/mapi/"" " _
& " xmlns:mapit=""http://schemas.microsoft.com/mapi/proptag/"" " _
& " xmlns:x=""xml:"" xmlns:cal=""urn:schemas:calendar:"" " _
& " xmlns:dt=""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/"" " _
& " xmlns:header=""urn:schemas:mailheader:"" " _
& " xmlns:mail=""urn:schemas:httpmail:""> " _
& " <g:set> " _
& " <g:prop> " _
& "
<g:contentclass>urn:content-classes:calendarmessage</g:contentclass> " _
& "
<e:outlookmessageclass>Ipm.Schedule.Meeting.Canceled</e:outlookmessageclass>
" _
& " <e:x-priority-long dt:dt=""int"">2</e:x-priority-long> " _
& " <mail:subject>Canceled: Test apt123</mail:subject> " _
& " <mail:htmldescription>Meeting
Cancelled</mail:htmldescription> " _
& " <cal:dtstart
dt:dt=""dateTime.tz"">2005-12-28T23:00:00.000Z</cal:dtstart> " _
& " <cal:dtend
dt:dt=""dateTime.tz"">2005-12-28T23:30:00.000Z</cal:dtend> " _
& " <cal:busystatus>FREE</cal:busystatus> " _
& " <cal:alldayevent dt:dt=""boolean"">0</cal:alldayevent> " _
& " <cal:meetingstatus>CANCELLED</cal:meetingstatus> " _
& " <cal:responserequested
dt:dt=""boolean"">1</cal:responserequested> " _
& " <cal:method>CANCEL</cal:method> " _
& " <cal:instancetype>3</cal:instancetype> " _
& "
<cal:uid>CD0000008B9511D182D800C04FB1625D64CB89851D50504190EDFD0E8F15B8A3</cal:uid>
" _
& " <header:to>Youruser@domain.com</header:to> " _
& " <header:cc></header:cc> " _
& " <header:bcc></header:bcc> " _
& " </g:prop> " _
& " </g:set> " _
& "</g:propertyupdate> "
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
sDestinationURL = "http://" & server & "/exchange/" & mailbox &
"/##DavMailSubmissionURI##/"
sSource = "http://" & server & "/exchange/" & mailbox & "/drafts/canreq.eml"
XMLreq.open "MOVE", sSource, False
xmlReq.setRequestHeader "Destination", sDestinationURL
XMLreq.setRequestHeader "Content-Type", "message/rfc822;"
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
"liz-kma" wrote in message
news:480A2D85-4A53-46E4-BD85-45C27951AE58@microsoft.com...
> Hello,
>
> I'm attempting to cancel a meeting using the following code:
>
> string messageUrl = this.GetMessageUrl(messageID);
> string xmlstr = "?Cmd=delete"+
> "&Action=cancel"+
> "&SENDUPDATE=1"+
> "&FormType=Appointment"+
> "&CmdReferring=edit"+
> "&Required="+
> "&Optional="+
> "&Resource="+
> "&MsgID="+messageUrl+
> "&CALENDAR="+messageUrl+
> "&urn:schemas:httpmail:textdescription="+textDescription+
> "&urn:schemas:httpmail:htmldescription="+htmlDescription;
>
> xmlstr = xmlstr.Replace(":","%3A").Replace("/","%2F");
>
> XMLHTTP xmlHttp_ = new XMLHTTP();
> xmlHttp_.open("POST", messageUrl, false, user, password);
> xmlHttp_.send(xmlstr);
>
> I always receive a 409 Conflict error. How can I cancel a meeting?
>
> If I should be using WebDav, can someone please post code that will handle
> this?
>
> Thanks,
> Liz
date: Thu, 29 Dec 2005 14:41:50 +1100
author: Glen Scales [MVP]
|
|