Enumere todos los sitios disponibles en una organización.
También se admiten criterios de filtro y opciones de consulta específicos y se describen a continuación:
Instrucción Filter
Select (instrucción)
Descripción
siteCollection/root ne null
siteCollection,webUrl
Listas todas las colecciones de sitios de nivel raíz de la organización. Útil para descubrir el sitio principal de cada geografía.
Además, puede usar una consulta de $search en la /sites colección para buscar sitios que coincidan con palabras clave dadas.
Si desea enumerar todos los sitios de todas las zonas geográficas, consulte getAllSites.
GET https://graph.microsoft.com/v1.0/sites?$select=siteCollection,webUrl&$filter=siteCollection/root%20ne%20null
// 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.Select = new string []{ "siteCollection","webUrl" };
requestConfiguration.QueryParameters.Filter = "siteCollection/root ne null";
});
// 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
)
requestFilter := "siteCollection/root ne null"
requestParameters := &graphsites.SitesRequestBuilderGetQueryParameters{
Select: [] string {"siteCollection","webUrl"},
Filter: &requestFilter,
}
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.select = new String []{"siteCollection", "webUrl"};
requestConfiguration.queryParameters.filter = "siteCollection/root ne null";
});
# 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(
select = ["siteCollection","webUrl"],
filter = "siteCollection/root ne null",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.sites.get(request_configuration = request_configuration)
// 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();
// 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"
//other-imports
)
// 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(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
SiteCollectionResponse result = graphClient.sites().get();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
result = await graph_client.sites.get()