2

I'm trying to update the Owner of a SP Group. This is what I've tried:

import pnp from "pnp";

let newgroup = {};
pnp.sp.web.siteGroups.getByName("BA_Actuarial").get().then(function(g) {
    newgroup = g
})

let group  = pnp.sp.web.siteGroups.getByName("BA_SargonTest").expand("owner")

group.get().then(data => {
    console.log(data, newgroup)
    group.update({
        Owner: newgroup
    })
})

2 Answers 2

0

This is currently not possible using REST API's itself. So, using PnP JS core also, it wont be possible, as its a wrapper of SP REST APIs.

User voice - Add the possibility to set the Owner when creating a SharePoint Group using REST API

Mark Anderson's blog - Capture missing SP REST API endpoints

Workaround using the old _vti_bin/client.svc looks like possible (haven't tested).

Set group owner using REST API

0

I was able to resolve this using information from the following article: https://www.sharepointeurope.com/set-a-sharepoint-group-owner-with-power-automate/

The request below works to add an existing 'SharePoint group' as the owner of another (newly created) SharePoint group within a SharePoint Communication Site: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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