0

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 = "blaha",
        PolicyTitle = "blahej"
    }
},
"/_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!

  • Do you want to do this using REST only? you can also do it using CSOM – Ganesh Sanap Feb 26 at 9:54
  • Yes, REST only please. @GaneshSanap – xCander Feb 26 at 9:58
  • I am not able to find any concrete solution using REST :( – Ganesh Sanap Feb 26 at 9:59
1

You can configure information right management by CSOM in SharePoint online. But I am not able to find any concrete solution to do it using REST API. For more detailed information, check things below links:

References:

  1. Office 365 – Automating the Configuration of Information Rights Management (IRM) using CSOM

  2. Sharepoint Online -O365- templates

Check if the endpoint URI structure for InformationRightsManagementSettings object is correct according to the article below:

SP.InformationRightsManagementSettings object

Also, I found that some developers are also getting the same error:

The type SP.InformationRightsManagementSettings does not support HTTP POST method.

Reference:

  1. Cannot Update/Create IRM (Infromation Rights Management) on library/file using REST Api.
  • Okey, then I have a side-question. Is it possible to use CSOM with netstandard 2.0? We're doing this in a Azure Function – xCander Feb 26 at 10:04
  • Not sure about netstandard 2.0 But you can use SharePoint CSOM with azure fucntions. Check this. – Ganesh Sanap Feb 26 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.