The users can restrict the permission of the content documents and the E-mail messages in Office Online by using Information Rights Management (IRM). Site collection admin can configure which IRM options are available to your organization by using Group Policy.
First, create a client context, using Office 365 site and load the required document library, which is stored in $Lists. Access the IRmenabled properties and make it to true and set the title of the new IRM policy.
The properties given below are available for the manipulation.
- AllowWriteCopy.
- DisableDocumentBrowserView.
- DocumentLibraryProtectionExpireDate.
- DocumentAccessExpireDays.
- EnableDocumentAccessExpire.
- EnableDocumentBrowserPublishingView.
- EnableGroupProtection.
- EnableLicenseCacheExpire.
- LicenseCacheExpireDays.
- $ClientContext = New-Object Microsoft.SharePoint.Client.ClientContext(“”http:
- $CCreds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username,$Password)
- $ClientContextContext.Credentials = $CCreds
- $Lists = $Context.Web.Lists
- $ClientContextContext.Load($Lists)
- $ClientContextContext.ExecuteQuery()
- $List = $Lists.GetByTitle(“Documents”)
- $Context.Load($List)
- $Context.ExecuteQuery()
- $List.IrmEnabled = $true
- $List.InformationRightsManagementSettings.PolicyDescription = “My Policy”
- $List.InformationRightsManagementSettings.PolicyTitle =”My Policy Name”
- $List.InformationRightsManagementSettings.AllowPrint = $false
- $List.InformationRightsManagementSettings.AllowScript = $true
- $List.InformationRightsManagementSettings.AllowWriteCopy = $true
- $List.InformationRightsManagementSettings.DisableDocumentBrowserView = $false
- $List.InformationRightsManagementSettings.DocumentLibraryProtectionExpireDate = #Date
- $List.InformationRightsManagementSettings.DocumentAccessExpireDays = 10
- $List.InformationRightsManagementSettings.EnableDocumentAccessExpire = $true
- $List.InformationRightsManagementSettings.EnableDocumentBrowserPublishingView = $true
- $List.InformationRightsManagementSettings.EnableGroupProtection = $true
- $List.InformationRightsManagementSettings.EnableLicenseCacheExpire $true
- $List.InformationRightsManagementSettings.LicenseCacheExpireDays = 15
- $List.InformationRightsManagementSettings.GroupName = “mygrp:
- $List.Update()
- $ClientContext.ExecuteQuery()