Deepak gupta
Deepak gupta

Reputation: 1958

Remove outlook meeting request

I'm creating an application in C#. In this i can create a meeting request that is sent to the user through code and appears in Outlook mail.

The below code is what I am using to send the meeting invitation. It is working fine.

StringBuilder OutlookBody = new StringBuilder();
string textvs = @"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
LOCATION:" + Location + @"
DTSTART:" + string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", start) + @"
DTEND:" + string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", end) + @"
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:= " + OutlookBody + @"=0D=0A SUMMARY:" + AppoitmentName + @"
PRIORITY:3
END:VEVENT
END:VCALENDAR";

How can i use the same code to remove outlook meeting request.

I have also checked this answer, but it didn't solve my problem.

Upvotes: 12

Views: 2091

Answers (4)

Sanaullah Khan
Sanaullah Khan

Reputation: 26

I solved this issue by changing some lines in code.

  1. Change method from REQUEST to CANCEL ==> str.AppendLine("METHOD:CANCEL");

  2. Change Status to Cancelled ==> str.AppendLine("STATUS:CANCELLED");

  3. In System.Net.Mime.ContentType contype = newSystem.Net.Mime.ContentType("text/calendar"); change method from REQUEST to CANCEL ==> contype.Parameters.Add("method", "CANCEL");

Upvotes: 0

Vikas Sardana
Vikas Sardana

Reputation: 1643

Use the following code

StringBuilder OutlookBody = new StringBuilder();
string textvs = @"BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
LOCATION:" + Location + @"
DTSTART:" + string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", start) + @"
DTEND:" + string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", end) + @"
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:= " + OutlookBody + @"=0D=0A SUMMARY:" + AppoitmentName + @"
PRIORITY:3
METHOD:CANCEL
STATUS:CANCELLED
END:VEVENT
END:VCALENDAR";

And use the following Mime Type

System.Net.Mime.ContentType mimeType = new System.Net.Mime.ContentType("text/calendar; method=CANCEL");

AlternateView alternate = AlternateView.CreateAlternateViewFromString(body, mimeType);
message.AlternateViews.Add(alternate);

Upvotes: 0

jomsk1e
jomsk1e

Reputation: 3625

You can set the method and status of the meeting by adding these lines:

METHOD: CANCEL

STATUS: CANCELLED

See more here.

Upvotes: 2

Rama Kathare
Rama Kathare

Reputation: 930

In OutLook every appointment/meeting will get a unique Id and a ChangeKey. A new ChangeKey is generated whenever there is a modification done to the meeting. To update an existing meeting you must have the Id and latest ChangeKey.

In your approach, if I am not wrong, you are just constructing an ICAL which is added to the outlook via email. In this case, you will not have the Id and ChangeKey to modify the meeting programatically. I would rather suggest you to change the approach.

If you have Microsoft Exchange the following links will guide. Else, ignore the links.

https://msdn.microsoft.com/en-us/library/office/dn495611(v=exchg.150).aspx https://msdn.microsoft.com/en-us/library/office/dn495612(v=exchg.150).aspx

Upvotes: 2

Related Questions