How to archiving Teams via Graph API

How to archiving Teams via Graph API

Archiving a team or a group can help preserve the content and settings of the team or group, while preventing users from making changes to it. In this article, we will explore three cool Graph API calls that can help you archive teams and groups using HTTP requests.

1. Archive a team

To archive a team, you can use the action on the resource. Archiving a team will make it read-only for all members and owners, and disable most changes to the team settings. However, membership changes are still allowed. Archiving a team is an async operation, which means that the team is archived once the async operation completes successfully, which may occur after the response from the API. To archive a team, the team and group must have an owner. To restore a team from its archived state, you can use the action. The HTTP request for archiving a team is as follows:

The request body can optionally include the parameter, which defines whether to set permissions for team members to read-only on the SharePoint Online site associated with the team. Setting it to false or omitting the body altogether will result in this step being skipped. If the archiving is started successfully, the API will return a response code, along with a header that contains the location of the that was created to handle archiving of the team. You can check the status of the archiving operation by making a GET request to this location.

2. Archive a group

To archive a group, you can use the action on the resource. Archiving a group will make it read-only for all members and owners, and disable most changes to the group settings. However, membership changes are still allowed. Archiving a group is an async operation, which means that the group is archived once the async operation completes successfully, which may occur after the response from the API. To archive a group, the group must have an owner. To restore a group from its archived state, you can use the action. The HTTP request for archiving a group is as follows:

The request body must include the parameter, which specifies the type of the group to be archived. The only supported value is , which indicates a Microsoft 365 group. If the archiving is started successfully, the API will return a response code, along with a header that contains the location of the that was created to handle archiving of the group. You can check the status of the archiving operation by making a GET request to this location.

3. List archived teams or groups

To list all the archived teams or groups in your organization, you can use the operation on the or resource, and filter by the property. The property indicates whether the team or group is in an archived state. The value is true if the team or group is archived, and false otherwise. The HTTP request for listing archived teams is as follows:

The HTTP request for listing archived groups is as follows:

Both requests will return a response code, along with a collection of or objects that match the filter criteria.

I hope you enjoyed reading this article and learned something new. If you want to know more about the Graph API and how to work with Microsoft Teams, you can check out the Microsoft Graph documentation and the Microsoft Teams API overview. Thank you for your interest and have a great day!

Sources

Archive team - Microsoft Graph v1.0 | Microsoft Learn. https://learn.microsoft.com/en-us/graph/api/team-archive?view=graph-rest-1.0.

Use the Microsoft Graph API to work with Microsoft Teams. https://learn.microsoft.com/en-us/graph/api/resources/teams-api-overview?view=graph-rest-1.0.

Use the Microsoft Graph API to work with Microsoft Teams. https://learn.microsoft.com/en-us/graph/api/resources/teams-api-overview?view=graph-rest-1.0.

Hello, is it possible to archive a group chat using power automate? 

Like
Reply
Ragnar Heil

HanseVisionär, Microsoft MVP Copilot & M365, Corporate Influencer, Internat.Speaker, Governance Pro

1y

Great idea.to use it with Rencore Governance which supports HTTP Requests. Would fit well to your former posting about Governance

Kasper Larsen

Dual Microsoft MVP (SharePoint+Dev), Senior Solution Architect at Fellowmind, Member of the PnP Modern search, " If your Information Architecture is lacking, forget all about a good Search or Copilot experience"

1y

To view or add a comment, sign in

Others also viewed

Explore topics