none
Content controls in Outlook email RRS feed

  • Question

  • Hi

    My Outlook plugin embeds the content controls in the mail message items. Everything work well and I can see these controls when e-mail is received. But sometimes (at some PCs) Outlook removes the content controls from the mail message when it gets sent.

    Any suggestions why that can happen and how to prevent content controls removal from mail items?

    I'm using VS2010, Outlook 2010, VSTO 4.

    Thank you in advance.


    John

    Friday, October 26, 2012 7:31 AM

Answers

  • i would try going this way:

    1. both sending and recieving end must have your plugin installed.

    2. send this metadata inside attachment, you can make it hidden, outlook usually will respect that

    3. using that metadata from attachment do as you would like in first place - additional panel, highliting inside reading panel (this would require redemption to get access to word object model in reading panel), etc.

    • Marked as answer by EwgenyM Tuesday, October 30, 2012 12:40 PM
    Tuesday, October 30, 2012 12:34 PM

All replies

  • What content controls are you talking about?
     
    How are they embedded in outgoing emails?
     
    What BodyFormat is used when the items are sent, and is that the same as when they're received?
     
    Have you checked the Outlook Mail option settings on machines where this worked and compared them to machines where it doesn't work? That's what's going to solve your problem in the end.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "EwgenyM" <=?utf-8?B?RXdnZW55TQ==?=> wrote in message news:a278f85d-e3b8-4c5e-9bf6-053ff0bbc24c...

    Hi

    My Outlook plugin embeds the content controls in the mail message items. Everything work well and I can see these controls when e-mail is received. But sometimes (at some PCs) Outlook removes the content controls from the mail message when it gets sent.

    Any suggestions why that can happen and how to prevent content controls removal from mail items?

    I'm using VS2010, Outlook 2010, VSTO 4.

    Thank you in advance.


    John


    Ken Slovak MVP - Outlook
    Friday, October 26, 2012 1:16 PM
  • Hi, Ken Slovak.

    I add content controls to the mail item in the following way:

    var inspector = Globals.ThisAddIn.Application.ActiveInspector();

    var item = (MailItem)inspector.CurrentItem;

    var document = (Microsoft.Office.Interop.Word.Document)inspector.WordEditor;

    var range = document.Application.Selection.Range;

    var rng = (object)range;

    var contentControl = document.ContentControls.Add(WdContentControlType.wdContentControlRichText, ref rng);

    I will compare Outlook mentioned setting on those PCs.

    I will also try the following code to specify body format explicitly:

    item.BodyFormat = OlBodyFormat.olFormatHTML;

    When I use olFormatRichText content controls are always removed.


    John



    • Edited by EwgenyM Monday, October 29, 2012 12:14 PM
    Monday, October 29, 2012 12:11 PM
  • Also, obviously the recipient would have to be running Outlolok to be using Word as the email editor, and it might make a difference what version of Outlook/WordMail they're running. My guess is the body format of the emails though.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "EwgenyM" <=?utf-8?B?RXdnZW55TQ==?=> wrote in message news:9d983de7-b05e-4f67-99cd-90a395307077...

    Hi, Ken Slovak.

    I add content controls to the mail item in the following way:

    var inspector = Globals.ThisAddIn.Application.ActiveInspector();

    var item = (MailItem)inspector.CurrentItem;

    var document = (Microsoft.Office.Interop.Word.Document)inspector.WordEditor;

    var range = document.Application.Selection.Range;

    var rng = (object)range;

    var contentControl = document.ContentControls.Add(WdContentControlType.wdContentControlRichText, ref rng);

    I will compare Outlook mentioned setting on those PCs.

    I will also try the following code to specify body format explicitly:

    item.BodyFormat = OlBodyFormat.olFormatHTML;

    When I use olFormatRichText content controls are always removed.


    John




    Ken Slovak MVP - Outlook
    Monday, October 29, 2012 6:11 PM
  • i think in general you cannot expect to have word's content controls preserved in email on recieving end - mail server, mail reader, etc. are free to change internal structure of mail body.
    Tuesday, October 30, 2012 8:41 AM
  • Thank you, DamianD.

    That's what I'm afraid most of all. I think that this is mail server that trims content controls in my case.

    What I'm trying to achieve with content controls is marking e-mail content with tags. Can you suggest any alternatives to content controls that will be embedded in the e-mail itself and won't be trimmed by mail server/reader/...?


    John

    Tuesday, October 30, 2012 9:28 AM
  • Thank you, Ken.

    Yes, you are right. I'm targeting Outlook 2010 as e-mail client only.

    I'm testing the solution with explicit body format and will come back with the results soon.


    John

    Tuesday, October 30, 2012 9:33 AM
  • What do you want to achieve in broader sense? Sending structured information inside mail's body? Where should that information be exposed? only inside your organization (recipiens from the same Exchange)?
    Tuesday, October 30, 2012 12:08 PM
  • I'm building Outlook plugin that implements something similar to OneNote Tags feature but in respect to e-mail content. Plugin uses content controls to mark dozens of e-mail body with tags of different types (answer/question/etc.). The recipient of such an e-mail could be any user who uses Outlook as e-mail reader. But only users with this plugin installed will see the tags in a structured way in additional panel. User can be outside the organization and can use mail server other than Exchange. However Outlook as e-mail reader is required. Only HTML format is going to be supported.

    Content controls looked very convenient to me. But looks like gmail server trims them out of the e-mail HTML. That's my guess though.


    John

    Tuesday, October 30, 2012 12:23 PM
  • i would try going this way:

    1. both sending and recieving end must have your plugin installed.

    2. send this metadata inside attachment, you can make it hidden, outlook usually will respect that

    3. using that metadata from attachment do as you would like in first place - additional panel, highliting inside reading panel (this would require redemption to get access to word object model in reading panel), etc.

    • Marked as answer by EwgenyM Tuesday, October 30, 2012 12:40 PM
    Tuesday, October 30, 2012 12:34 PM
  • Thank you for the great suggestion, DamianD.

    I could store the original HTML of the email with content controls included as hidden attachment and restore the tags from this copy when receiving the email.


    John

    Tuesday, October 30, 2012 12:40 PM