Forum Discussion
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!
I'm sorry InformationRightsManagementSettings attribute is Read Only from REST API, while IrmEnabled is Read and Write.
Try to make a post directly to this endpoint /<site>/_api/web/lists(listid)/InformationRightsManagementSettings/allowPrint ( https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj247181%28v%3doffice.15%29 ) it seems to be supported :)
Cheers,
Federico
4 Replies
I'm sorry InformationRightsManagementSettings attribute is Read Only from REST API, while IrmEnabled is Read and Write.
Try to make a post directly to this endpoint /<site>/_api/web/lists(listid)/InformationRightsManagementSettings/allowPrint ( https://docs.microsoft.com/en-us/previous-versions/office/sharepoint-visio/jj247181%28v%3doffice.15%29 ) it seems to be supported :)
Cheers,
Federico
- viktorjonssonCopper Contributor
May I ask what json payload you're sending when you post directly to .../AllowPrint?
I'm trying the following and get status code 200 back but the boolean value does not change.
await MakeJsonRequestAsync( new { AllowPrint = true }, "/_api/web/lists('" +listId+ "')/InformationRightsManagementSettings/allowPrint", newSiteUrl, accessToken, HttpMethod.Post, headers: new Dictionary() { } );