Forum Discussion

viktorjonsson's avatar
viktorjonsson
Copper Contributor
Feb 26, 2019

Unable to update InformationRightsManagement using REST (sharepoint-online)

The following request returns status 204, indicating it was a success but the informationrights settings hasn't become updated when I take a look the IRM-settings in the web gui for the list.

 

The property `IrmEnabled` seems to have been updated on the list but not the informationRightsManagementSettings!?

var resp = await MakeJsonRequestAsync(new
{
    __metadata = new Metadata() { type = "SP.List" },
    IrmEnabled = true,
    IrmReject = true,
    IrmExpire = true,
    InformationRightsManagementSettings = new
    {
        __metadata = new Metadata() { type = "SP.InformationRightsManagementSettings" },
        AllowPrint = true,
        AllowScript = false,
        AllowWriteCopy = false,
        DisableDocumentBrowserView = false,
        DocumentAccessExpireDays = 90,
        DocumentLibraryProtectionExpireDate = DateTime.Now.AddMonths(6),
        EnableDocumentAccessExpire = false,
        EnableDocumentBrowserPublishingView = false,
        EnableGroupProtection = false,
        EnableLicenseCacheExpire = false,
        GroupName = "",
        LicenseCacheExpireDays = 31,
        PolicyDescription = "testpolicy",
        PolicyTitle = "Victors Test Policy"
    }
},
"/_api/web/lists(guid'" + listId.ToString() + "')/",
newSiteUrl, 
accessToken, 
HttpMethod.Post, 
new Dictionary<string, string>() {
    {"X-Http-Method", "MERGE"},
    { "If-Match", "*" }
});

I have also tried to make a POST directly to `/_api/web/lists(guid'" + listId + "')/informationRightsManagementSettings` but it ends up in status 400 no matter what I do.

 

Any help is greatly appreciated!