none
Sharepoint Online -O365- templates

    Question

  • Hi All,

    I am a relative noob to sharepoint so these are probably very easily answered questions.

    I am setting up a pilot environment.  We have a requirement that all applicable documents stored in SP are protected by IRM.  What I want to know is how can I change the default behaviour so that everytime a document library is created it is automatically protected by an IRM policy?

    Cheers

    Micah.

    Wednesday, November 16, 2016 3:31 PM

All replies

  • Hi,

    There is no such OOTB function for this currently, I think different library could have different IRM policy.

    You could consider to create  remote event receiver for your site, if any new document library created, setting the IRM by CSOM.

    Here is sample code for your reference:

    _list.IrmEnabled = true;
                    //#title
                    _list.InformationRightsManagementSettings.PolicyTitle = "SE IRM";
                    //# description
                    _list.InformationRightsManagementSettings.PolicyDescription = "SE IRM Policy";
                    //# reject items that do not support IRM
                    _list.IrmReject = true;
                    //# expire the restriction
                    _list.IrmExpire = true;
                    _list.InformationRightsManagementSettings.DocumentLibraryProtectionExpireDate = DateTime.Now.AddMonths(1);
                    //# disable opening documents in the browser
                    _list.InformationRightsManagementSettings.DisableDocumentBrowserView = true;
                    //# allow users to print
                    _list.InformationRightsManagementSettings.AllowPrint = true;
                    //# allow script script and screen reader functions to downloaded documents
                    _list.InformationRightsManagementSettings.AllowScript = true;
                    //# allow viewers to write a copy of the downloaded documents
                    _list.InformationRightsManagementSettings.AllowWriteCopy = true;
                    //# access rights expiry
                    _list.InformationRightsManagementSettings.EnableDocumentAccessExpire = true;
                    _list.InformationRightsManagementSettings.DocumentAccessExpireDays = 30;//# between 1 and 365
                    //# require credential verification
                    _list.InformationRightsManagementSettings.EnableLicenseCacheExpire = true;
                    _list.InformationRightsManagementSettings.LicenseCacheExpireDays = 30;
                    //# Allow group protection
                    _list.InformationRightsManagementSettings.EnableGroupProtection = true;
    
                    _list.Update();
                    context.ExecuteQuery();

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Thursday, November 17, 2016 8:04 AM
  • Hi Lee,

    Thanks for that, lets just "pretend" I am an idiot and have no idea how to create a remote event reciever using CSOM, do you have a link to a technet article or such on how to create a new CSOM remote event reciever?

    ;)

    Cheers Micah

    Thursday, November 17, 2016 2:06 PM
  • Hi,

    Here are some threads for your reference:

    http://www.codeproject.com/Articles/1043978/Remote-Event-Receivers-RER-in-SharePoint-Online

    https://amjadk.com/2016/06/04/steps-to-write-remote-event-receivers-o365-sharepoint-online/

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

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, November 18, 2016 1:20 AM
  • Hi,

    Is any update for your issue?

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Friday, November 25, 2016 8:29 AM
  • Hi Lee,

    This is what I have completed so far..

    Download and Install Visual Studio 2015
    Download and Install Office Development tools for Visual Studio 2015
    Create the SharePoint Development Site Collection in O365 Tenancy
    Grant Permission to the SharePoint Development Site Collection to the Developers

    In Visual Studio

    Create the new project > File New Project
    Select Office/Sharepoint – Web Add Ins – SharePoint Add-in
    Choose SharePoint Hosted

    Choose SharePoint Online

    In Solution Explorer
    • Right click Solution > New Item
    • Remote Event Reciever

    Select "On List Events" & Choose "List was added"

    I now have the remoteEventReciever in the Solution Explorer and can see the code, but I am unsure of where to place your code..

            /// <summary>
            /// Handles events that occur after an action occurs, such as after a user adds an item to a list or deletes an item from a list.
            /// </summary>
            /// <param name="properties">Holds information about the remote event.</param>
            public void ProcessOneWayEvent(SPRemoteEventProperties properties)
            {
                using (ClientContext clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties))
                {
                    if (clientContext != null)
                    {
                        clientContext.Load(clientContext.Web);
                        clientContext.ExecuteQuery();
                    }
                }
            }

    Cheers

    Micah

    Friday, November 25, 2016 12:11 PM
  • Hi,

    Here are some threads for your reference:

    https://msdn.microsoft.com/EN-US/library/office/mt637895.aspx

    https://blogs.msdn.microsoft.com/officeapps/2013/01/03/debugging-remote-event-receivers-with-visual-studio/

    Hope these could help.

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Wednesday, November 30, 2016 9:07 AM