none
How to disable the Mail Body of Microsoft.Office.Interop.Outlook.AppointmentItem RRS feed

  • Question

  • Hi,

    Kindly help me so that I can make a Meeting body of Microsoft.Office.Interop.Outlook.AppointmentItem non-editable.

    I am developing a Shared Extensible Addin for Outlook 2007 and I am generating Meeting Body by code.

    Microsoft.Office.Interop.Outlook.AppointmentItem.Body="some code".

    Please give a hint I can make the body non-editable by users in Microsoft.Office.Interop.Outlook.Inspector AppointmentItem object.

    Thanks.

    Wednesday, April 24, 2013 9:21 AM

Answers

  • If you can use Redemption you can use an RDOAppointmentItem, which has an HTMLBody property. An Outlook AppointmentItem does not have an HTMLBody. Any formatting you want to do with text must be done with RTFBody, which uses Rich Text format.
     
    For a number of reasons using the Word object model doesn't work correctly with appointments, as was discussed in another thread in this forum recently.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "nirmallyakoley" <=?utf-8?B?bmlybWFsbHlha29sZXk=?=> wrote in message news:0f96324d-48d2-4a30-9664-6f0d98f2677f...

    Hi Ken,

    Thanks for your reply.

    Can you kindly help if I can write any HTML  syntax in the body of the AppointmentItem.

    I am using Microsoft.Office.Interop.Word.Document objDoc=Microsoft.Office.Interop.Outlook.Inspector.WordEditor;

    I want to write some HTML code in the document,is it possible??

    Regards,

    Nirmallya


    Ken Slovak MVP - Outlook
    Wednesday, April 24, 2013 8:48 PM
    Moderator
  • You won't be able to do that. Most CSS is disabled in Outlook and JavaScript won't run.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "nirmallyakoley" <=?utf-8?B?bmlybWFsbHlha29sZXk=?=> wrote in message news:98339fbb-7389-4365-8b86-04929508b89a...

    Hi Ken,

    I am able to paste a HTML string in Microsoft.Office.Interop.Outlook.Inspector.WordEditor object by the following code.

    Microsoft.Office.Interop.Word.Document doc = Microsoft.Office.Interop.Outlook.Inspector.WordEditor  Microsoft.Office.Interop.Word.Selection wrdSelection = doc.Application.Selection;

      DataObject dataObject = new DataObject();
                    dataObject.SetData(DataFormats.Html, "html string");
                    Clipboard.SetDataObject(dataObject, true);
                    wrdSelection.Paste();

    Pasting the html string from Clipboard object.

    But when using JavaScript or CSS to disable the html object or restricting the user from focusing the html object I am not able to do that.


    Ken Slovak MVP - Outlook
    Thursday, May 2, 2013 1:58 PM
    Moderator

All replies

  • You can't prevent users from editing the item bodies, you won't get any events to handle for that until the user closes the item or tries to save it. You can then handle the Close() and or Write() events on the item and disallow any changes.
     
    About the only other way I can think of would be to put some sort of Information Rights Management (IRM)permissioning on the item to disallow changes, but that might present other problems at various points in the process. See http://office.microsoft.com/en-us/outlook-help/introduction-to-using-irm-for-e-mail-messages-HA010100366.aspx for information on IRM.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "nirmallyakoley" <=?utf-8?B?bmlybWFsbHlha29sZXk=?=> wrote in message news:ebbd03d1-c44c-426e-877d-40b791915088...

    Hi,

    Kindly help me so that I can make a Meeting body of Microsoft.Office.Interop.Outlook.AppointmentItem non-editable.

    I am developing a Shared Extensible Addin for Outlook 2007 and I am generating Meeting Body by code.

    Microsoft.Office.Interop.Outlook.AppointmentItem.Body="some code".

    Please give a hint I can make the body non-editable by users in Microsoft.Office.Interop.Outlook.Inspector AppointmentItem object.

    Thanks.


    Ken Slovak MVP - Outlook
    Wednesday, April 24, 2013 2:52 PM
    Moderator
  • Hi Ken,

    Thanks for your reply.

    Can you kindly help if I can write any HTML  syntax in the body of the AppointmentItem.

    I am using Microsoft.Office.Interop.Word.Document objDoc=Microsoft.Office.Interop.Outlook.Inspector.WordEditor;

    I want to write some HTML code in the document,is it possible??

    Regards,

    Nirmallya

    Wednesday, April 24, 2013 8:02 PM
  • If you can use Redemption you can use an RDOAppointmentItem, which has an HTMLBody property. An Outlook AppointmentItem does not have an HTMLBody. Any formatting you want to do with text must be done with RTFBody, which uses Rich Text format.
     
    For a number of reasons using the Word object model doesn't work correctly with appointments, as was discussed in another thread in this forum recently.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "nirmallyakoley" <=?utf-8?B?bmlybWFsbHlha29sZXk=?=> wrote in message news:0f96324d-48d2-4a30-9664-6f0d98f2677f...

    Hi Ken,

    Thanks for your reply.

    Can you kindly help if I can write any HTML  syntax in the body of the AppointmentItem.

    I am using Microsoft.Office.Interop.Word.Document objDoc=Microsoft.Office.Interop.Outlook.Inspector.WordEditor;

    I want to write some HTML code in the document,is it possible??

    Regards,

    Nirmallya


    Ken Slovak MVP - Outlook
    Wednesday, April 24, 2013 8:48 PM
    Moderator
  • Hi Ken,

    I am able to paste a HTML string in Microsoft.Office.Interop.Outlook.Inspector.WordEditor object by the following code.

    Microsoft.Office.Interop.Word.Document doc = Microsoft.Office.Interop.Outlook.Inspector.WordEditor  Microsoft.Office.Interop.Word.Selection wrdSelection = doc.Application.Selection;

      DataObject dataObject = new DataObject();
                    dataObject.SetData(DataFormats.Html, "html string");
                    Clipboard.SetDataObject(dataObject, true);
                    wrdSelection.Paste();

    Pasting the html string from Clipboard object.

    But when using JavaScript or CSS to disable the html object or restricting the user from focusing the html object I am not able to do that.

    Thursday, May 2, 2013 5:55 AM
  • You won't be able to do that. Most CSS is disabled in Outlook and JavaScript won't run.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "nirmallyakoley" <=?utf-8?B?bmlybWFsbHlha29sZXk=?=> wrote in message news:98339fbb-7389-4365-8b86-04929508b89a...

    Hi Ken,

    I am able to paste a HTML string in Microsoft.Office.Interop.Outlook.Inspector.WordEditor object by the following code.

    Microsoft.Office.Interop.Word.Document doc = Microsoft.Office.Interop.Outlook.Inspector.WordEditor  Microsoft.Office.Interop.Word.Selection wrdSelection = doc.Application.Selection;

      DataObject dataObject = new DataObject();
                    dataObject.SetData(DataFormats.Html, "html string");
                    Clipboard.SetDataObject(dataObject, true);
                    wrdSelection.Paste();

    Pasting the html string from Clipboard object.

    But when using JavaScript or CSS to disable the html object or restricting the user from focusing the html object I am not able to do that.


    Ken Slovak MVP - Outlook
    Thursday, May 2, 2013 1:58 PM
    Moderator