Configure response buttons in ICS invitation (c#)

Viewed 15

I have created a code in c# to send ICS type invitations and they work perfectly. The invitee receives the mail and in it he can, among other things, accept or decline the invitation. If he accepts it, his calendar (works with google calendar and outlook at least) is updated. My problem is that I need the ONLY options for the guest to accept and decline, I don't want him to be able to propose another date or add comments. Here is an excerpt of the relevant code:

    StringBuilder str = new StringBuilder();
    str.AppendLine("BEGIN:VCALENDAR"); // Init Calendar
    str.AppendLine("PRODID:-//test//EN"); // Identifier for the product that created the Calendar object
    str.AppendLine("VERSION:2.0"); // Indicates that the data is in iCalendar format
    str.AppendLine("METHOD:REQUEST"); // Request, Cancel
    str.AppendLine("CALSCALE:GREGORIAN");
    str.AppendLine("BEGIN:VEVENT");
    str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", DateTime.UtcNow));
    str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", startTime)); // Start time            
    if (Utility.IsNotEmptyStr(endTime))
        str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", endTime)); // End time
    if (Utility.IsNotEmptyStr(location))
        str.AppendLine(string.Format("LOCATION: {0}", location)); // Location
    str.AppendLine(string.Format("UID:{0}", "evendronescanflyaway@gmail.com")); // ID
    str.AppendLine(string.Format("DESCRIPTION:{0}", body)); // Body
    str.AppendLine(string.Format("SUMMARY:{0}", subject)); // Subject    
    str.AppendLine(string.Format("STATUS:{0}", cancelled ? "CANCELLED" : "CONFIRMED")); // Confirmed, Cancelled
    str.AppendLine(string.Format("ORGANIZER;CN=\"{0}\":MAILTO:{1}", senderDisplayName, "evendronescanflyaway@gmail.com"));
    foreach (RcptObject attendee in rcpts)
        str.AppendLine(string.Format($@"ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN={attendee.EMail};X-NUM-GUESTS=0:MAILTO:{attendee.EMail}"));

    str.AppendLine("END:VEVENT");
    str.AppendLine("END:VCALENDAR"); // End Calendar


    System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar"); // MIME Type
    ct.Parameters.Add("method", "REQUEST");
    ct.Parameters.Add("name", "invite.ics");
    AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct);
    avCal.TransferEncoding = System.Net.Mime.TransferEncoding.QuotedPrintable;

Is this possible?

0 Answers
Related