user3690095
user3690095

Reputation:

ics c# asp.net appointment invite

I am trying to create an outlook appointment ICS file using C# Asp.net. Below is a sample code that I got from the internet, but it is missing Subject, and also attendees. How can I include that in the code? For example Meeting Subject is: "Finance meeting" Attendees is: [email protected], [email protected], [email protected]

public string MakeHourEvent(string subject, string location, DateTime date, string startTime, string endTime)
   {
string filePath = string.Empty;
string path = HttpContext.Current.Server.MapPath(@"\iCal\");
filePath = path + subject + ".ics";
writer = new StreamWriter(filePath);
writer.WriteLine("BEGIN:VCALENDAR");
writer.WriteLine("VERSION:2.0");
writer.WriteLine("PRODID:-//hacksw/handcal//NONSGML v1.0//EN");
writer.WriteLine("BEGIN:VEVENT");
string startDateTime = GetFormatedDate(date)+"T"+GetFormattedTime(startTime);
string endDateTime = GetFormatedDate(date) + "T" + GetFormattedTime(endTime);
writer.WriteLine("DTSTART:" + startDateTime);
writer.WriteLine("DTEND:" + endDateTime);
writer.WriteLine("SUMMARY:" + subject);
writer.WriteLine("LOCATION:" + location);
writer.WriteLine("END:VEVENT");
writer.WriteLine("END:VCALENDAR");
writer.Close();
return filePath;
}

Upvotes: 0

Views: 1365

Answers (1)

Peter
Peter

Reputation: 36

The subject is in the SUMMARY: parameter. DESCRIPTION: is used for the "body".

Attendees are added using ATTENDEE: property, i.e.

ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;RSVP=TRUE;CN="John Smith" ;X-NUM-GUESTS=0:mailto:[email protected]

Upvotes: 2

Related Questions