Unable to get only active sites via graph api

Cohesity Magneto 0 Reputation points
2023-11-29T15:19:44.5433333+00:00

We are using following graph API to get all sites . but it returning all sites including deleted one , and not able to distinct between active and delete site as no such attribute in response also.

Is there any filter or other way to get active sites only using graph api

https://graph.microsoft.com/v1.0/sites?search=*

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Akash Jadav 85 Reputation points Microsoft External Staff
    2023-11-29T17:14:48.8366667+00:00

    Can we try following reference for the same?

    Reference: https://learn.microsoft.com/en-us/graph/api/site-getallsites

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.]

    0 comments No comments

  2. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2023-11-30T02:56:22.8633333+00:00

    Hi @Cohesity Magneto,

    You could use GET /sites to list all available sites in an organization. Please refer to the following api

    GET https://graph.microsoft.com/v1.0/sites
    

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.