locked
How to set document Permission (RMS) RRS feed

  • السؤال

  • Hi,

    Using Office you can set permissions on document from ribbon > File > Info > Protect Document >restrict Access. How I can do that from code?

    In Outlook it is quit simple you can set MailItem.PermissionTemplateGuid

    Word doesn't have such property it has Permission property object but i didn't found  any way to set the permission from policy. I am using Office 2013.

    Any idea?

    16/ذو القعدة/1436 02:31 م

جميع الردود

  • >>>Using Office you can set permissions on document from ribbon > File > Info > Protect Document >restrict Access. How I can do that from code?

    As far as I searching, I think you could not do that.

    Information Rights Management (IRM) allows individuals and administrators to set access permissions to documents, workbooks, presentations, and e-mail messages.

    This helps prevent sensitive information from being printed, forwarded, or copied by unauthorized people.

    After permission for a file is restricted by using IRM, the access and usage restrictions are enforced even if the file reaches unintended recipients.

    This is because the access permissions are stored in the document, workbook, presentation, or e-mail message itself. And these must be authenticated against the server.

    For more information, click here to refer about About restricting access with Information Rights Management

    If you want to add protection to Microsoft Office Word documents to prevent users from making any edits to the document,

    you could refer to How to: Programmatically Protect Documents and Parts of Documents

    https://msdn.microsoft.com/en-us/library/ms178793.aspx

    • تم الاقتراح كإجابة بواسطة David_JunFeng 23/ذو القعدة/1436 09:54 ص
    • تم وضع علامة كإجابة بواسطة Fei XueMicrosoft employee 24/ذو القعدة/1436 02:44 ص
    • تم إلغاء علامة كإجابة بواسطة Mr Konrad Sikorski 24/ذو القعدة/1436 07:55 ص
    17/ذو القعدة/1436 07:22 ص
  • Thx David, I know what RMS is but I don't know how to use it programically. The protected mechanizm in Office documents is totally diferent thing, I know how it works and how to use it but this is not my question.

    So I still looking for answer how to use RMS from VSTO. As I mentioned the API for Outlook is quite simply but for Word is not.


    24/ذو القعدة/1436 07:59 ص
  • Hi Konrad

    See if the Permission object (as in Document.Permission) is what you're looking for. Since my machine doesn't have access to a server that can handle IRM I don't see the "restrict access" menu selection. But the Help topic sounds like what you're asking about...


    Cindy Meister, VSTO/Word MVP, my blog

    24/ذو القعدة/1436 05:27 م
  • Thx David, I know what RMS is but I don't know how to use it programically. The protected mechanizm in Office documents is totally diferent thing, I know how it works and how to use it but this is not my question.

    So I still looking for answer how to use RMS from VSTO. As I mentioned the API for Outlook is quite simply but for Word is not.


    Hi Konrad, did you succeed on your requirement? im facing the same req.

    Could you please share any info you got?

    Thanks in advance

    04/رمضان/1437 12:07 م
  • Microsoft.Office.Interop.Word.Application application = null;
    application = System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application") as Microsoft.Office.Interop.Word.Application;
    Microsoft.Office.Interop.Word.Document document = application.Documents.Open(FileName: @"D:\IRM3.docx", ReadOnly: false);
    DateTime dtExpirationDate = DateTime.Today.AddMinutes(3);
    document.Permission.Enabled = true;
    document.Permission.Add(null, Microsoft.Office.Core.MsoPermission.msoPermissionFullControl, dtExpirationDate);
    document.Close(true);   
    • تم التحرير بواسطة Jitendra G Chauhan 17/ربيع الأول/1441 09:13 ص
    17/ربيع الأول/1441 09:13 ص