Reputation: 11
Am trying to display HTML content inside the Outlook Appointment body but am not able to (i tried for both body and FTFbody option). Anyone Please help me . Below is my code .
private void button1_Click(object sender, RibbonControlEventArgs e)
{
Outlook.Application application = Globals.ThisAddIn.Application;
Outlook.Inspector inspector = application.ActiveInspector();
Outlook.AppointmentItem AppointmentItem = inspector.CurrentItem as Outlook.AppointmentItem;
if (AppointmentItem != null)
{
if (AppointmentItem.EntryID == null)
{
string messageBody = string.Empty;
string defaultMessageBody = "Click <a href='https://www.google.com/' > here </a>";
AppointmentItem.Subject = "This text was added by using code";
AppointmentItem.Recipients.Add("[email protected]");
AppointmentItem.Location = "INDIA";
//AppointmentItem.RTFBody = System.Text.Encoding.Default.GetBytes(defaultMessageBody);
AppointmentItem.Body = defaultMessageBody;
AppointmentItem.Save();
}
}
}
Upvotes: 0
Views: 1673
Reputation: 11
We need to convert the HTML content to the byte array and then display it in the HTML body then we can able to get the full html body . Until unless byte conversion we are not able to get the html content in the appointment plug-in . please vote if it solve your problem. Thank you :)
Upvotes: 0
Reputation: 66215
Firstly, you should not be using Outlook (or any other Office app) under a service (such as ASP.Net).
Secondly, Outlook 2016 and higher supports HTML in appointments, but that support has not been exposed through the Outlook Object Model. You can attempt to set the PR_HTML
property (DASL name http://schemas.microsoft.com/mapi/proptag/0x10130102
) using AppointmentItem.PropertyAccessor.SetProperty
, but Outlook won't see your change until you completely dereference and reopen the item.
Upvotes: 1