0

Is there any way to update the SharePoint Online Modern team site "Title" using Rest API or graph API.

I tried the below code, but it is not updating.

 import { Web } from "sp-pnp-js";

let web = new Web("https://company.sharepoint.com/sites/sitename");

web.update({
    Title: "New Title",   
    Description: "My new description"
}).then(w => {

    console.log(w);
});

I figured out that Microsoft is using https://company.sharepoint.com/sites/sitename/_api/SP.Directory.DirectorySession/Group('GroupID') this api to get the properties and update the properties. But I cannot use this as it is not documented.

Is there any API which will update the title and description at group level?

1 Answer 1

0

By default, a SharePoint modern site is automatically connected to a Office 365 Group. We can use Azure Active Directory Graph API to update group properties, then it will sync to the modern site.

Request:

PATCH https://graph.microsoft.com/v1.0/groups/{id}
Content-type: application/json
Content-length: 211

{
  "description": "description-value",
  "displayName": "displayName-value",
  "groupTypes": [
    "Unified"
  ]  
}

Working with groups in Microsoft Graph

2
  • Thank you Joanna. I tried this code and it is updating, but it is taking too long to reflect in the site.
    – Prakash
    Aug 29, 2018 at 12:21
  • Indeed. Is there any way to make this sync faster?
    – rtn
    Nov 24, 2022 at 3:29

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.