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 Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,317 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,211 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Akash Jadav 85 Reputation points Microsoft Vendor
    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 33,481 Reputation points Microsoft Vendor
    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.