获取分区
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
检索 section 对象的属性 和 关系。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Notes.Create、Notes.Read、Notes.ReadWrite、Notes.Read.All、Notes.ReadWrite.All
委派(个人 Microsoft 帐户)
Notes.Create、Notes.Read、Notes.ReadWrite
应用程序
Notes.Read.All、Notes.ReadWrite.All
HTTP 请求
GET /me/onenote/sections/{id}
GET /users/{id | userPrincipalName}/onenote/sections/{id}
GET /groups/{id}/onenote/sections/{id}
GET /sites/{id}/onenote/sections/{id}
可选的查询参数
此方法支持 select 和 expand OData 查询参数 来帮助自定义响应。
默认查询将 parentNotebook 展开并选择其 、 id displayName 和 self 属性。 分区 expand 的有效值为 和 parentNotebook parentSectionGroup 。
名称
类型
说明
Authorization
string
Bearer {token}。必需。
接受
string
application/json
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法在响应正文中返回 响应代码和 200 OK onenoteSection 对象。
示例
请求
下面是一个请求示例。
GET https://graph.microsoft.com/beta/me/onenote/sections/{id}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var onenoteSection = await graphClient.Me.Onenote.Sections["{onenoteSection-id}"]
.Request()
.GetAsync();
const options = {
authProvider,
};
const client = Client.init(options);
let onenoteSection = await client.api('/me/onenote/sections/{id}')
.version('beta')
.get();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/onenote/sections/{id}"]]];
[urlRequest setHTTPMethod:@"GET"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
MSGraphOnenoteSection *onenoteSection = [[MSGraphOnenoteSection alloc] initWithData:data error:&nserror];
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
OnenoteSection onenoteSection = graphClient.me().onenote().sections("{id}")
.buildRequest()
.get();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
onenoteSectionId := "onenoteSection-id"
result, err := graphClient.Me().Onenote().SectionsById(&onenoteSectionId).Get()
Import-Module Microsoft.Graph.Notes
# A UPN can also be used as -UserId.
Get-MgUserOnenoteSection -UserId $userId -OnenoteSectionId $onenoteSectionId
响应
下面是一个响应示例。注意:为了简单起见,会将此处所示的响应对象截断。将从实际调用中返回所有属性。
HTTP/1.1 200 OK
Content-type: application/json
{
"isDefault": true,
"pagesUrl": "pagesUrl-value",
"displayName": "name-value",
"createdBy": {
"user": {
"id": "id-value",
"displayName": "displayName-value"
}
},
"lastModifiedBy": {
"user": {
"id": "id-value",
"displayName": "displayName-value"
}
}
}