我正在使用Visual Studio 2010和Outlook2013。我试图在约会正文/ rtfbody中发送超链接,但我得到了单独的文本和URL。在这里,我分享了我的代码和输出。
Microsoft.Office.Interop.Outlook.Application outlookApp = new Microsoft.Office.Interop.Outlook.Application(); // creates new outlook app
Microsoft.Office.Interop.Outlook.AppointmentItem oAppointment = (Microsoft.Office.Interop.Outlook.AppointmentItem)outlookApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
oAppointment.Subject = "Enquiry Changes made to " + "Anbuchelvan" + "'s enquiry"; // set the subject
RichTextBox rtb = new RichTextBox();
rtb.Rtf = System.Text.Encoding.UTF8.GetString(oAppointment.RTFBody);
rtb.Select(rtb.TextLength, 0);
rtb.SelectedRtf = @"{\rtf1\ansi{\fonttbl\f0\fswiss Helvetica;}\f0\pard {\par} {\field{\*\fldinst HYPERLINK ""http://www.google.com/""}{\fldrslt Click Here}}";
oAppointment.RTFBody = System.Text.Encoding.UTF8.GetBytes(rtb.Rtf);
// oAppointment.Body = // set the body
oAppointment.Location = "Nicks Desk!"; // set the location
oAppointment.Start = Convert.ToDateTime(DateTime.Now); // Set the start date
oAppointment.End = Convert.ToDateTime(DateTime.Now); // End date
oAppointment.ReminderSet = true; // Set the reminder
oAppointment.ReminderMinutesBeforeStart = 15; // reminder time
oAppointment.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh; // appointment importance
oAppointment.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
oAppointment.Recipients.ResolveAll();
oAppointment.Display(true);
oAppointment.Save();
我的输出是:
Click Here <http://www.google.com/>
答案 0 :(得分:0)
我们在使用HTML的这种实现方面取得了巨大的成功。
<a href='http://www.google.com'>Click Here</a>