I'm trying to change the owner of a group via the REST API. I'm working entirely within the host web, so no cross domain calls from the app web. If I run the below code, it succeeds and changes the title of the group.
$.ajax({
url: "https://harepontsoce3.sharepoint.com/_api/Web/SiteGroups/GetById(62)",
type: "MERGE",
data: "{ '__metadata': { 'type': 'SP.Group' }, 'Title':'ABC333'",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
}
}).done(function (data) { // end .ajax
debugger;
console.log("Done");
}).fail(function (error) {
debugger;
console.log(error.responseText);
});
However, when I add the 'Owner':{'Id':'6'}
to the data payload, it still succeeds in that the .done callback is hit and I get no errors. But the title and owner are not changed.
$.ajax({
url: "https://areptsorce.sharepoint.com/_api/Web/SiteGroups/GetById(62)",
type: "MERGE",
data: "{ '__metadata': { 'type': 'SP.Group' }, 'Title':'ABC333', 'Owner':{'Id':'6'}}",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
}
}).done(function (data) { // end .ajax
debugger;
console.log("Done");
}).fail(function (error) {
debugger;
console.log(error.responseText);
});
I have read other post the say you CAN NOT use REST to change the owner of a group and instead you need to use client.svc service and including an XML body. However, is does not make sense to me because of the following documentation directly from MS:
Everything in this documentation is telling me changing the group owner via REST is possible. What am I missing?