Search across a SharePoint tenant for sites that match keywords provided.
The only property that works for sorting is createdDateTime. The search filter is a free text search that uses multiple properties when retrieving the search results.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
Sites.Read.All
Sites.ReadWrite.All
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
Sites.Read.All
Sites.ReadWrite.All
Note: This method does not support the Sites.Selected application permission.
GET https://graph.microsoft.com/v1.0/sites?search={query}
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Sites.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Search = "{query}";
});
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphsites "github.com/microsoftgraph/msgraph-sdk-go/sites"
//other-imports
)
requestSearch := "{query}"
requestParameters := &graphsites.SitesRequestBuilderGetQueryParameters{
Search: &requestSearch,
}
configuration := &graphsites.SitesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
sites, err := graphClient.Sites().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
SiteCollectionResponse result = graphClient.sites().get(requestConfiguration -> {
requestConfiguration.queryParameters.search = "{query}";
});
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.sites.sites_request_builder import SitesRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
query_params = SitesRequestBuilder.SitesRequestBuilderGetQueryParameters(
search = "{query}",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.sites.get(request_configuration = request_configuration)