本文介绍了Outlook日历中的约会的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好, 我的代码工作正常,可以发送约会。但受邀者无法接受会议预约。选项接受/ Tectative / Decline显示无效。 任何人都可以指导我主动接受/推特/拒绝选项。 private void SendAppointment( string subject, string To,DateTime Start,DateTime End) { try { DateTime dtNow = DateTime.Now; MailMessage msg = new MailMessage(); msg.From = new MailAddress( [email protected]); msg.To.Add(To); ; msg.Subject = subject; msg.Body = 这是Body Content; msg.IsBodyHtml = true ; StringBuilder str = new StringBuilder(); str.AppendLine( BEGIN:VCALENDAR); str.AppendLine( PRODID: - //安排会议); str.AppendLine( VERSION:2.0); str.AppendLine( METHOD:REQUEST); str.AppendLine( BEGIN:VEVENT); str.AppendLine( string .Format( DTSTART:{0:yyyyMMddTHHmmssZ},Start.ToUniversalTime()。ToString( yyyyMMdd \ \THHmmss\\Z))); str.AppendLine( string .Format( DTSTAMP:{0:yyyyMMddTHHmmssZ},(End - Start).Minutes.ToString())); str.AppendLine( string .Format( DTEND:{0:yyyyMMddTHHmmssZ},End.ToUniversalTime()。ToString( yyyyMMdd \ \THHmmss\\Z))); str.AppendLine( LOCATION:TBD); // str.AppendLine(string.Format(UID:{0},Guid.NewGuid( ))); str.AppendLine( string .Format( DESCRIPTION:{0},msg.Body)); str.AppendLine( string .Format( X-ALT-DESC; FMTTYPE = text / html:{0},msg.Body)); str.AppendLine( string .Format( 摘要:{0},msg.Subject)); str.AppendLine( string .Format( ORGANIZER:MAILTO:{0},msg.From.Address)); str.AppendLine( string .Format( ATTENDEE; CN = \{0} \; RSVP = TRUE:mailto:{1},msg.To [ 0 ] .DisplayName,msg.To [ 0 ]。地址)); str.AppendLine( BEGIN:VALARM); str.AppendLine( TRIGGER:-PT15M); str.AppendLine( ACTION:DISPLAY); str.AppendLine( DESCRIPTION:Reminder); str.AppendLine( END:VALARM); str.AppendLine( END:VEVENT); str.AppendLine( END:VCALENDAR); System.Net.Mail.SmtpClient smtpclient = new System.Net.Mail.SmtpClient(); smtpclient.Host = 53.151.100.102; smtpclient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType( text / calendar); ct.Parameters.Add( method, REQUEST); ct.Parameters.Add( name, Meeting.ics); AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(),ct); msg.AlternateViews.Add(avCal); smtpclient.Send(msg); } catch (例外情况) { lblError.Visible = 真; lblError.Text = ex.Message; } 请帮助解决方案 这太不可思议了复杂的事情。我前段时间对约会也有同样的问题。花了大约12个小时就可以了。您应该首先尝试做什么:在附件中添加Meeting.ics。尝试不同的内容类型:multipart / alternative,使用AlternateViews。 http://stackoverflow.com/问题/ 461889 / sending-outlook-meeting-requests-without-outlook [ ^ ] // 纯文本和HTML说明(Outlook需要HTML版本) string bodyText = 请参加项目XYZ审查会议。; string bodyHtml = < p>请参加项目XYZ审查会议。< / p>; // 约会数据 - 请参阅http://tools.ietf.org/html/ rfc2445了解详情 string appointmentData = BEGIN:VCALENDAR \ n + PRODID: Rebex Mail \ n + VERSION:2.0 \ n + BEGIN:VTIMEZONE \ n + TZID:US-Eastern \ n + BEGIN:STANDARD\\\ + DTSTART:19981025T020000 \ n + RDATE:19981025T020000 \ n + TZOFFSETFROM:-0400 \ n + TZOFFSETTO:-0500 \ n + TZNAME:EST\\\ + END:STANDARD\\\ + BEGIN:DAYLIGHT \ n + DTSTART:19990404T020000 \ n + RDATE:19990404T020000 \ n + TZOFFSETFROM:-0500 \ n + TZOFFSETTO:-0400 \ n + TZNAME:EDT \ n + END:DAYLIGHT \ n + END:VTIMEZONE \ n + BEGIN:VEVENT \ n + DTSTAMP:19980309T231000Z \ n + UID:guid-1.host1.com \ n + ORGANIZER; ROLE = CHAIR:MAILTO:[email protected] \ n + ATTENDEE; RSVP = TRUE; ROLE = REQ-PARTICIPANT; CUTYPE = GROUP:MAILTO:[email protected]\\\ + 描述:项目XYZ审查会议\ n + CATEGORIES:MEETING\ n + CLASS:PUBLIC \ n + 已创建:19980309T130000Z \ n + 摘要:XYZ项目评论\ n + DTSTART; TZID = US-Eastern:19980312T083000 \ n + DTEND; TZID = US -Eastern:19980312T093000 \ n + 位置:1CP会议室4350 \ n + END:VEVENT \ n + END:VCALENDAR \ n; // 构建日历视图 AlternateView appointment = new AlternateView(); appointment.SetContent(appointmentData, text / calendar); appointment.ContentType.Parameters.Add( method, REQUEST); // 构造消息 MailMessage message = new MailMessage(); message.BodyText = bodyText; message.BodyHtml = bodyHtml; message.AlternateViews.Add(约会); // 保存邮件 message.Save(。 ..); Hi All,My code is working fine to send Appointment.but the invitee couldn't accept the Meeting appointment.The options Accept/Tectative/Decline shows Inactive.Any one guide me to active Accept/Tectative/Decline option.private void SendAppointment(string subject,string To,DateTime Start,DateTime End) { try { DateTime dtNow = DateTime.Now; MailMessage msg = new MailMessage(); msg.From = new MailAddress("[email protected]"); msg.To.Add(To); ; msg.Subject = subject; msg.Body = "Here is the Body Content"; msg.IsBodyHtml = true; StringBuilder str = new StringBuilder(); str.AppendLine("BEGIN:VCALENDAR"); str.AppendLine("PRODID:-//Schedule a Meeting"); str.AppendLine("VERSION:2.0"); str.AppendLine("METHOD:REQUEST"); str.AppendLine("BEGIN:VEVENT"); str.AppendLine(string.Format("DTSTART:{0:yyyyMMddTHHmmssZ}", Start.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"))); str.AppendLine(string.Format("DTSTAMP:{0:yyyyMMddTHHmmssZ}", (End - Start).Minutes.ToString())); str.AppendLine(string.Format("DTEND:{0:yyyyMMddTHHmmssZ}", End.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z"))); str.AppendLine("LOCATION: TBD"); // str.AppendLine(string.Format("UID:{0}", Guid.NewGuid())); str.AppendLine(string.Format("DESCRIPTION:{0}", msg.Body)); str.AppendLine(string.Format("X-ALT-DESC;FMTTYPE=text/html:{0}", msg.Body)); str.AppendLine(string.Format("SUMMARY:{0}", msg.Subject)); str.AppendLine(string.Format("ORGANIZER:MAILTO:{0}", msg.From.Address)); str.AppendLine(string.Format("ATTENDEE;CN=\"{0}\";RSVP=TRUE:mailto:{1}", msg.To[0].DisplayName, msg.To[0].Address)); str.AppendLine("BEGIN:VALARM"); str.AppendLine("TRIGGER:-PT15M"); str.AppendLine("ACTION:DISPLAY"); str.AppendLine("DESCRIPTION:Reminder"); str.AppendLine("END:VALARM"); str.AppendLine("END:VEVENT"); str.AppendLine("END:VCALENDAR"); System.Net.Mail.SmtpClient smtpclient = new System.Net.Mail.SmtpClient(); smtpclient.Host = "53.151.100.102"; smtpclient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials; System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType("text/calendar"); ct.Parameters.Add("method", "REQUEST"); ct.Parameters.Add("name", "Meeting.ics"); AlternateView avCal = AlternateView.CreateAlternateViewFromString(str.ToString(), ct); msg.AlternateViews.Add(avCal); smtpclient.Send(msg); } catch (Exception ex) { lblError.Visible = true; lblError.Text = ex.Message; }Please help 解决方案 this is incredible complicated thing. I had the same problem with appointments some time ago. Spent about 12 hours on it. What you should try to do first: add "Meeting.ics" in the attachment. Try different content types: multipart/alternative, with AlternateViews.http://stackoverflow.com/questions/461889/sending-outlook-meeting-requests-without-outlook[^]// plaintext and HTML descriptions (HTML version is required by Outlook)string bodyText = "Please come to project XYZ review meeting.";string bodyHtml = "<p>Please come to project XYZ review meeting.</p>";// appointment data - see http://tools.ietf.org/html/rfc2445 for detailsstring appointmentData = "BEGIN:VCALENDAR\n" + "PRODID:Rebex Mail\n" + "VERSION:2.0\n" + "BEGIN:VTIMEZONE\n" + "TZID:US-Eastern\n" + "BEGIN:STANDARD\n" + "DTSTART:19981025T020000\n" + "RDATE:19981025T020000\n" + "TZOFFSETFROM:-0400\n" + "TZOFFSETTO:-0500\n" + "TZNAME:EST\n" + "END:STANDARD\n" + "BEGIN:DAYLIGHT\n" + "DTSTART:19990404T020000\n" + "RDATE:19990404T020000\n" + "TZOFFSETFROM:-0500\n" + "TZOFFSETTO:-0400\n" + "TZNAME:EDT\n" + "END:DAYLIGHT\n" + "END:VTIMEZONE\n" + "BEGIN:VEVENT\n" + "DTSTAMP:19980309T231000Z\n" + "UID:guid-1.host1.com\n" + "ORGANIZER;ROLE=CHAIR:MAILTO:[email protected]\n" + "ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:[email protected]\n" + "DESCRIPTION:Project XYZ Review Meeting\n" + "CATEGORIES:MEETING\n" + "CLASS:PUBLIC\n" + "CREATED:19980309T130000Z\n" + "SUMMARY:XYZ Project Review\n" + "DTSTART;TZID=US-Eastern:19980312T083000\n" + "DTEND;TZID=US-Eastern:19980312T093000\n" + "LOCATION:1CP Conference Room 4350\n" + "END:VEVENT\n" + "END:VCALENDAR\n";// construct the calendar viewAlternateView appointment = new AlternateView();appointment.SetContent(appointmentData, "text/calendar");appointment.ContentType.Parameters.Add("method", "REQUEST");// construct the messageMailMessage message = new MailMessage();message.BodyText = bodyText;message.BodyHtml = bodyHtml;message.AlternateViews.Add(appointment);// save the messagemessage.Save(...); 这篇关于Outlook日历中的约会的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
07-06 20:07