J'essaye de créer un rendez-vous de consultation ICS utilisant C# Asp.net. Voici un exemple de code que j'ai obtenu sur Internet, mais il manque Sujet, et aussi les participants. Comment puis-je inclure cela dans le code? Par exemple Réunion Le sujet est: "réunion Finance" Les participants sont: [email protected], [email protected], [email protected]ics C# asp.net rendez-vous invitation
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;
}
Le "sujet" n'est-il pas le champ "SOMMAIRE" comme indiqué dans cette variable dans votre code? –
Il est probablement préférable d'utiliser une bibliothèque qui peut créer l'information nécessaire pour vous, plutôt que de la recréer vous-même. Regardez dans [DDay.iCal] (https://github.com/mdavid/DDay.iCal). – mason