TransWikia.com

How to update ShqrePoint Group name?

SharePoint Asked by Kaddrik on November 26, 2020

hope everything is fine.

I managed to created / delete SharePoint groups but also add and remove users using HTTP requests.

The problem i’m facing now is … how can I update the name of a group ??

I did something which is a mix between the group creation and the addition of user but that throws an error "__metadata does not exist in method GetById"

the problem is i can only reference my group from the ID since the name of the group has changed….

Would someone please be able to help me …?

Thanks a lot in advance

enter image description here

2 Answers

You could try to use js to test the request,after the test is successful,you fill in the value one by one.

This code works well:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>

<script>
$(function(){
$("#btnClick").click(function(){
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/sitegroups/getbyId(23)";
$.ajax({
url: requestUri,
type: "POST",
data:JSON.stringify({'__metadata': { 'type': 'SP.Group' }, 'Title':'testing'}),
headers: {
"content-type": "application/json;odata=verbose",
"X-HTTP-Method":"MERGE",
"X-RequestDigest": $("#__REQUESTDIGEST").val()
},
success: onSuccess,
error: onError
});
function onSuccess(data) {
alert('Group description updated successfully');
}
function onError(error) {
alert(JSON.stringify(error));
}
});
});
</script>
<input type="button" id="btnClick" value="Update SharePoint Group Details"/>

Then you could find you need to add "X-HTTP-Method":"MERGE" in header.

Correct answer by Amos_MSFT on November 26, 2020

#Config Variables $SiteURL = "https://xxxxxx.com" $GroupName= "Sales Portal Members" $NewGroupName ="Sales Managers"

#Connect PNP Online Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)

#Update the Group Name Set-PnPGroup -Identity $GroupName -Title $NewGroupName

Answered by MD ASADUZZAMAN on November 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP