列出权限
命名空间:microsoft.graph
从 网站上 的权限导航属性获取权限资源。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
不支持。 |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
Sites.FullControl.All |
HTTP 请求
GET /sites/{sitesId}/permissions
可选的查询参数
此方法支持一些 OData 查询参数来帮助自定义响应。 若要了解一般信息,请参阅 OData 查询参数。
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 响应代码和 200 OK permission 对象集合。
示例
请求
GET https://graph.microsoft.com/v1.0/sites/{sitesId}/permissions
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var queryOptions = new List<QueryOption>()
{
new QueryOption("search", "{query}")
};
var sites = await graphClient.Sites
.Request( queryOptions )
.GetAsync();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
const options = {
authProvider,
};
const client = Client.init(options);
let sites = await client.api('/sites?search=%7Bquery%7D')
.get();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/sites?search=%7Bquery%7D"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
NSError *jsonError = nil;
MSCollection *collection = [[MSCollection alloc] initWithData:data error:&jsonError];
MSGraphSite *site = [[MSGraphSite alloc] initWithDictionary:[[collection value] objectAtIndex: 0] error:&nserror];
}];
[meDataTask execute];
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new QueryOption("search", "{query}"));
SiteCollectionPage sites = graphClient.sites()
.buildRequest( requestOptions )
.get();
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestParameters := &msgraphsdk.SitesRequestBuilderGetQueryParameters{
Search: "%7Bquery%7D",
}
options := &msgraphsdk.SitesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
result, err := graphClient.Sites().GetWithRequestConfigurationAndResponseHandler(options, nil)
有关如何将 SDK 添加 到项目并 创建 authProvider 实例的 详细信息,请参阅 SDK 文档。
响应
HTTP/1.1 200 OK
Content-Type: application/json
{
"value": [
{
"id": "1",
"@deprecated.GrantedToIdentities": "GrantedToIdentities has been deprecated. Refer to GrantedToIdentitiesV2",
"roles": ["read"],
"grantedToIdentities": [{
"application": {
"id": "89ea5c94-7736-4e25-95ad-3fa95f62b66e",
"displayName": "Contoso Time Manager App"
}
}],
"grantedToIdentitiesV2": [{
"application": {
"id": "89ea5c94-7736-4e25-95ad-3fa95f62b66e",
"displayName": "Contoso Time Manager App"
}
}]
},
{
"id": "2",
"@deprecated.GrantedToIdentities": "GrantedToIdentities has been deprecated. Refer to GrantedToIdentitiesV2",
"roles": ["write"],
"grantedToIdentities": [{
"application": {
"id": "22f09bb7-dd29-403e-bec2-ab5cde52c2b3",
"displayName": "Fabrikam Dashboard App"
}
}],
"grantedToIdentitiesV2": [{
"application": {
"id": "22f09bb7-dd29-403e-bec2-ab5cde52c2b3",
"displayName": "Fabrikam Dashboard App"
}
}]
}
]
}