0

I need a function to create a hyperlink in a appointmentItem.Body. For mailItem it works fine. I need a similiar one for the appointmentItem. I didn't found any usefull hints.

if (ThisAddIn.mailItem != null) { 

                ThisAddIn.mailItem.HTMLBody += "<a href='"+link+"'>Click here to call.</a>";

                }else if(ThisAddIn.appointmentItem != null){

                    ThisAddIn.appointmentItem.Body += link;

                }

Thanks for your help

dodu0815
  • 23
  • 4

1 Answers1

1

The Body property contains only the plain text.

You need to use the RTFBody property instead. See What is the RTF syntax for a hyperlink for the RTF markup.

Community
  • 1
  • 1
Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45
  • That's a good idea, but how have I to use it? This is not working for me: ThisAddIn.appointmentItem.RTFBody += "{\\field{\\*\\fldinst HYPERLINK 'Click here to call'}{\\fldrslt " + link + "}}" – dodu0815 Dec 18 '14 at 14:47
  • The [RTFBody](http://msdn.microsoft.com/en-us/library/office/ff861303(v=office.15).aspx) property returns or sets a **Byte array** that represents the body of the Microsoft Outlook item in Rich Text Format. – Eugene Astafiev Dec 18 '14 at 14:51
  • i tried this, but it's also not working. Can you be more specific, please? System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); byte[] byteArray = enc.GetBytes("{\\field{\\*\\fldinst HYPERLINK '"+link+"'}{\\fldrslt Click here to call}}"); Encoding encoding = Encoding.Default; string RTF = encoding.GetString(byteArray); ThisAddIn.appointmentItem.RTFBody += RTF; – dodu0815 Dec 18 '14 at 14:57