Skip to main content
added 379 characters in body
Source Link
Ganesh Sanap - MVP
  • 46.4k
  • 22
  • 31
  • 63

You can assign permissions to SharePoint group using SharePoint REST API like:

function setPermissionForGroup(){
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/roleassignments/addroleassignment(principalid=<GroupId>, roledefid=1073741827)",
        type: "POST",
        contentType: "application/json;odata=verbose",
        headers: { "Accept": "application/json; odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val(),"X-HTTP-Method": "POST" },
        success: function (data) {
            alert('Contribute permission set on group');
        },
        error: function (data) {
            alert("Error: " + JSON.stringify(data));
        }
    });
});

Replace <GroupId> with the ID of SharePoint group. Open the SharePoint group & you will find the group ID in browser URL:

enter image description here

roledefid for Permission Levels are as follows:

  • 1073741829: Full Control

    Full Control: 1073741829
  • 1073741827: Contribute

    Design: 1073741828
  • 1073741826: Read

    Edit: 1073741830
  • Contribute: 1073741827
  • Read: 1073741826
  • Limited Access: 1073741825
  • View Only: 1073741924

You need to convert above REST call in Power Automate Send an HTTP request to SharePoint action.

You can assign permissions to SharePoint group using SharePoint REST API like:

function setPermissionForGroup(){
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/roleassignments/addroleassignment(principalid=<GroupId>, roledefid=1073741827)",
        type: "POST",
        contentType: "application/json;odata=verbose",
        headers: { "Accept": "application/json; odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val(),"X-HTTP-Method": "POST" },
        success: function (data) {
            alert('Contribute permission set on group');
        },
        error: function (data) {
            alert("Error: " + JSON.stringify(data));
        }
    });
});

Replace <GroupId> with the ID of SharePoint group.

roledefid for Permission Levels are as follows:

  • 1073741829: Full Control

  • 1073741827: Contribute

  • 1073741826: Read

You can assign permissions to SharePoint group using SharePoint REST API like:

function setPermissionForGroup(){
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/roleassignments/addroleassignment(principalid=<GroupId>, roledefid=1073741827)",
        type: "POST",
        contentType: "application/json;odata=verbose",
        headers: { "Accept": "application/json; odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val(),"X-HTTP-Method": "POST" },
        success: function (data) {
            alert('Contribute permission set on group');
        },
        error: function (data) {
            alert("Error: " + JSON.stringify(data));
        }
    });
});

Replace <GroupId> with the ID of SharePoint group. Open the SharePoint group & you will find the group ID in browser URL:

enter image description here

roledefid for Permission Levels are as follows:

  • Full Control: 1073741829
  • Design: 1073741828
  • Edit: 1073741830
  • Contribute: 1073741827
  • Read: 1073741826
  • Limited Access: 1073741825
  • View Only: 1073741924

You need to convert above REST call in Power Automate Send an HTTP request to SharePoint action.

Source Link
Ganesh Sanap - MVP
  • 46.4k
  • 22
  • 31
  • 63

You can assign permissions to SharePoint group using SharePoint REST API like:

function setPermissionForGroup(){
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/roleassignments/addroleassignment(principalid=<GroupId>, roledefid=1073741827)",
        type: "POST",
        contentType: "application/json;odata=verbose",
        headers: { "Accept": "application/json; odata=verbose","X-RequestDigest": $("#__REQUESTDIGEST").val(),"X-HTTP-Method": "POST" },
        success: function (data) {
            alert('Contribute permission set on group');
        },
        error: function (data) {
            alert("Error: " + JSON.stringify(data));
        }
    });
});

Replace <GroupId> with the ID of SharePoint group.

roledefid for Permission Levels are as follows:

  • 1073741829: Full Control

  • 1073741827: Contribute

  • 1073741826: Read