none
Setting Permission Template to mail for Outlook 2013 RRS feed

  • Question

  • Hi,

    I am writing code to set permission to mail item.

       inboxMailItem = (Outlook.MailItem)currentItem;
                    string PSETID_Common = "http://schemas.microsoft.com/mapi/id/{00062008-0000-0000-C000-000000000046}/";
                    Outlook.PropertyAccessor pa = inboxMailItem.PropertyAccessor;
                    pa.SetProperty(PSETID_Common + "85B6001F", "All Accenture");  // set short name
                    pa.SetProperty(PSETID_Common + "85B7001F", "description");  // set description
                    pa.SetProperty(PSETID_Common + "85B8001F", "13c18421-5dce-4ec9-9193-2398bf045153");  // set GUID
                    
                    pa.SetProperty(PSETID_Common + "85B5000B", true); // Mark as Classified
                    pa.SetProperty(PSETID_Common + "85BA000B", true); // Keep classification
                    inboxMailItem.Permission = Outlook.OlPermission.olPermissionTemplate;

    I am getting the below error:

     The restricted permission for this message is invalid
       at Microsoft.Office.Interop.Outlook._MailItem.set_Permission

    Please let me know how I can fix the issue. The GUID of template to be applied is correct.

    Thanks

    Jaspreet Singh


    Jaspreet Singh


    Friday, April 3, 2015 10:17 AM

All replies

  • Hello Jaspreet,

    The Permission property description in MSDN states the following:

    The Permission property should be synchronized with the PermissionTemplateGuid property to accurately reflect the permission status of the MailItem. Setting the PermissionTemplateGuid property to a valid GUID also sets the Permission property toOlPermission.olPermissionTemplate.

    When no Information Rights Management (IRM) has been set up, (in which case the Permission property is OlPermission.olUnrestricted), or the restriction is not to forward the MailItem, (in which case the Permission property is OlPermission.olDoNotForward), the value of the PermissionTemplateGuid property should be an empty string.

    Based on the following statement:

    Setting the PermissionTemplateGuid property

    to a valid GUID also sets the Permission property

    to OlPermission.olPermissionTemplate.


    It looks like you just need to set a valid GUID to the PermissionTemplateGuid property.


    Friday, April 3, 2015 10:39 AM
  • Hi Eugene,

    Thanks. But removing below line doesn't trigger error but corresponding template is not getting applied.

    Thanks


    Jaspreet Singh

    Friday, April 3, 2015 10:50 AM
  • Hi

    Thanks for posting in MSDN forum.

    Since the issue is complex, I'm trying to involve some senior engineers into this issue and it will take some time. Your patience will be greatly appreciated.

    Sorry for any inconvenience and thanks for your understanding 

    Best Regards

    Lan


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, May 4, 2015 10:34 AM
    Moderator
  • Hello Jaspreet,

    If you’re still facing this issue, could you please answer the following:

    1. Are you able to send the email with those properties set on it (assuming you excluded the line inboxMailItem.Permission=Outlook.OlPermission.olPermissionTemplate; and have a valid guid)?
    2. Can you check using MFCMAPI (http://mfcmapi.codeplex.com) if the properties were stamped correctly on the outgoing email?


    This issue may need advanced troubleshooting for which it is advisable to open a service request with Microsoft support via https://support.microsoft.com/en-us/assistedsupportproducts

    Regards,
    Manish


    Friday, June 12, 2015 9:03 PM