section: copyToSectionGroup
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
将节复制到特定节组。
对于 Copy 操作,你可以遵循异步调用模式:首先调用 Copy 操作,然后轮询操作终结点的结果。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
Notes.Create、Notes.ReadWrite、Notes.ReadWrite.All
委派(个人 Microsoft 帐户)
Notes.Create、Notes.ReadWrite
应用程序
Notes.ReadWrite.All
HTTP 请求
POST /me/onenote/sections/{id}/copyToSectionGroup
POST /users/{id | userPrincipalName}/onenote/sections/{id}/copyToSectionGroup
POST /groups/{id}/onenote/sections/{id}/copyToSectionGroup
POST /sites/{id}/onenote/sections/{id}/copyToSectionGroup
名称
类型
说明
Authorization
string
Bearer {token}。必需。
Content-Type
string
application/json
请求正文
在请求正文中,提供 JSON 对象,其中包含操作所需的参数。
参数
类型
说明
siteCollectionId
String
要复制到SharePoint网站的 ID。 仅在复制到网站时SharePoint使用。
siteId
字符串
要复制到SharePoint Web 的 ID。 仅在复制到网站时SharePoint使用。
groupId
String
要复制到的组的 ID。 仅在复制到组时Microsoft 365使用。
id
String
必需。 目标分区组的 ID。
renameAs
字符串
副本的名称。 默认为现有项目的名称。
响应
如果成功,此方法返回 响应 202 Accepted 代码和标头 Operation-Location 。 轮询Operation-Location 终结点,获取复制操作的状态 。
示例
下面是一个如何调用此 API 的示例。
请求
下面是一个请求示例。
POST https://graph.microsoft.com/beta/me/onenote/sections/{id}/copyToSectionGroup
Content-type: application/json
{
"id": "id-value",
"groupId": "groupId-value",
"renameAs": "renameAs-value"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var id = "id-value";
var groupId = "groupId-value";
var renameAs = "renameAs-value";
await graphClient.Me.Onenote.Sections["{onenoteSection-id}"]
.CopyToSectionGroup(id,groupId,renameAs,null,null)
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const onenoteOperation = {
id: 'id-value',
groupId: 'groupId-value',
renameAs: 'renameAs-value'
};
await client.api('/me/onenote/sections/{id}/copyToSectionGroup')
.version('beta')
.post(onenoteOperation);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/onenote/sections/{id}/copyToSectionGroup"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSString *id = @"id-value";
payloadDictionary[@"id"] = id;
NSString *groupId = @"groupId-value";
payloadDictionary[@"groupId"] = groupId;
NSString *renameAs = @"renameAs-value";
payloadDictionary[@"renameAs"] = renameAs;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
String id = "id-value";
String groupId = "groupId-value";
String renameAs = "renameAs-value";
graphClient.me().onenote().sections("{id}")
.copyToSectionGroup(OnenoteSectionCopyToSectionGroupParameterSet
.newBuilder()
.withId(id)
.withGroupId(groupId)
.withRenameAs(renameAs)
.withSiteCollectionId(null)
.withSiteId(null)
.build())
.buildRequest()
.post();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
id := "id-value"
requestBody.SetId(&id)
groupId := "groupId-value"
requestBody.SetGroupId(&groupId)
renameAs := "renameAs-value"
requestBody.SetRenameAs(&renameAs)
onenoteSectionId := "onenoteSection-id"
result, err := graphClient.Me().Onenote().SectionsById(&onenoteSectionId).CopyToSectionGroup(onenoteSection-id).Post(requestBody)
Import-Module Microsoft.Graph.Users.Actions
$params = @{
Id = "id-value"
GroupId = "groupId-value"
RenameAs = "renameAs-value"
}
# A UPN can also be used as -UserId.
Copy-MgUserOnenoteSectionToSectionGroup -UserId $userId -OnenoteSectionId $onenoteSectionId -BodyParameter $params
响应
下面是一个响应示例。
HTTP/1.1 202 Accepted