2016-01-06 1 views
0

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; 
} 
+0

Le "sujet" n'est-il pas le champ "SOMMAIRE" comme indiqué dans cette variable dans votre code? –

+1

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

Répondre

2

Le sujet est dans le résumé: paramètre. DESCRIPTION: est utilisé pour le "corps".

Les participants sont ajoutés à l'aide PARTICIPANT: la propriété, à savoir

PARTICIPANT; CUTYPE = INDIVIDUEL; RÔLE = REQ-PARTICIPANT, RSVP = TRUE, CN = "John Smith" ; X-NUM-Guests = 0: mailto : [email protected]

+0

Merci Peter! – user3690095