Beispiel #1
0
        public string Add(MyCalEvent e)
        {
            StringBuilder output = new StringBuilder();

            output.AppendLine("BEGIN:VCALENDAR");
            output.AppendLine("PRODID:-//companyname-Email-Calander-Invite");
            output.AppendLine("VERSION:2.0");
            output.AppendLine("METHOD:" + e.method);
            output.AppendLine("BEGIN:VEVENT");
            output.AppendLine(string.Format("DTSTART:{0}", e.dtstart.ToString("yyyyMMddTHHmm00")));
            output.AppendLine(string.Format("DTSTAM:{0}", DateTime.Now.ToString("yyyyMMddTHHmm00")));
            output.AppendLine(string.Format("DTEND:{0}", e.dtend.ToString("yyyyMMddTHHmm00")));
            output.AppendLine(string.Format("LOCATION:{0}", e.location));
            output.AppendLine(string.Format("UID:{0}", Guid.NewGuid()));
            output.AppendLine(string.Format("DESCRIPTION:{0}", e.description));
            output.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", ""));
            output.AppendLine(string.Format("SUMMARY:{0}", e.summary));
            output.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", string.IsNullOrEmpty(e.organizer) ? e.organizer : e.organizer));
            output.AppendLine("BEGIN:VALARM");
            output.AppendLine(string.Format("TRIGGER:-PT{0}", e.alarm));
            output.AppendLine("ACTION:DISPLAY");
            output.AppendLine("DESCRIPTION:Reminder");
            output.AppendLine("END:VALARM");
            output.AppendLine("END:VEVENT");
            output.AppendLine("END:VCALENDAR");

            return output.ToString();
        }
Beispiel #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IInvitation cal = new Gmail();
        MyCalEvent evt = new MyCalEvent(DateTime.Now, DateTime.Now.AddDays(2), "post");

        string result = cal.Add(evt);

        MailMessage mail = new MailMessage();
        mail.To.Add("type the email address that you want to recieve");
        mail.From = new MailAddress("type your email addresss");
        mail.Subject = "test icalendar mail";
        mail.Body = "test icalendar mail";
        System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar");
        ct.Parameters.Add("method", "REQUEST");
        AlternateView avCal = AlternateView.CreateAlternateViewFromString(result, ct);
        mail.AlternateViews.Add(avCal);
        SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
        smtp.EnableSsl = true;
        smtp.Send(mail);
    }
Beispiel #3
0
 public string Add(MyCalEvent evts)
 {
     throw new NotImplementedException();
 }