none
Doing IRM protection programatically for Office files in ASP.NET RRS feed

  • Question

  • Does anyone knows best practice or sample for doing IRM protection of Office files? We are doing it programatically in asp.net. It works few times but after few success, it start giving errors. Main reason is that and a tread of PowerPoint is stuck in process since it is waiting.

    We're doing IRM protection for PowerPoint and Excel files



    Tuesday, October 22, 2013 8:12 PM

Answers

All replies

  • Hi Jay,

    I pick up some articles about IRM and programmatically protect documents. Please refer to those references.

    http://msdn.microsoft.com/en-us/library/bb802693(v=office.14).aspx

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

    Hope this meet your requirement.

    Best Regards,


    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.

    Wednesday, October 23, 2013 9:17 AM
    Moderator
  • Thanks Hetro!

    We're not using SharePoint and all articles we come across IRM protection is around SharePoint. These article also mentions that it is based on SharePoint Foundation Services. We're on plain ASP.net and are deploying on a server at client network. Below is the code snippet:

    Powerpoint.Application ppApp = new Powerpoint.Application();
    Powerpoint._Presentation target = ppApp.Presentations.Add(Office.MsoTriState.msoTrue);
    .
    .
    Try
    {
    Pres.Permission.Enabled = true;
    if (Pres.Permission.Enabled) 

    Pres.Permission.Add("Everyone", MsoPermission.msoPermissionRead);
    }
    }
    catch (Exception ex)
    {
    throw new Exception("Permissions exception", ex);
    }

    Sometimes it works but often it gives following error: 

    The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
    COMException: The remote procedure call failed. (Exception from HRESULT: 0x800706BE)
    at Microsoft.Office.Core.Permission.set_Enabled(Boolean Enabled)

    Does this require some local configuration on the server for IRM? Or permissions?

    Thanks!


    Wednesday, October 23, 2013 12:55 PM
  • Hi Jay,

    There are too many reasons to allow the system to throw this exception. I guess it should be the user’s permission of ASP. NET. Please change the user of your website according the below picture. Ensure the user has the permission to access COM resources.

    Please provide the version of Windows, Office, IIS so that we can more accurately locate the problem.

    By the way, here is an article about considerations for server-side automation of using Office. Hope useful to your issue.

    http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q257/7/57.asp&NoWebContent=1

    Best Regards,


    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, October 28, 2013 8:12 AM
    Moderator