Add item to a bundle
-
Article
-
- 2 minutes to read
-
Namespace: microsoft.graph
Add an additional driveItem from a drive to a bundle.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type |
Permissions (from least to most privileged) |
Delegated (work or school account) |
Not supported. |
Delegated (personal Microsoft account) |
Files.ReadWrite, Files.ReadWrite.All |
Application |
Not supported. |
HTTP request
POST /drive/bundles/{bundle-id}/children
Name |
Description |
Authorization |
Bearer {token}. Required. |
Content-Type |
application/json. Required. |
Request body
In the request body, supply a JSON representation of a driveItem object.
Response
If successful, this method returns a 204 No Content
response code.
For information about error responses, see Microsoft Graph error responses and resource types.
Example
Request
The following is an example of a request that adds an existing item to the specified bundle.
POST https://graph.microsoft.com/v1.0/drive/bundles/{bundle-id}/children
Content-Type: application/json
{
"id": "123456!87"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var driveItem = new DriveItem
{
Id = "123456!87"
};
await graphClient.Drive.Bundles["{driveItem-id}"].Children
.Request()
.AddAsync(driveItem);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const driveItem = {
id: '123456!87'
};
await client.api('/drive/bundles/{bundle-id}/children')
.post(driveItem);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/drive/bundles/{bundle-id}/children"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphDriveItem *driveItem = [[MSGraphDriveItem alloc] init];
[driveItem setId:@"123456!87"];
NSError *error;
NSData *driveItemData = [driveItem getSerializedDataWithError:&error];
[urlRequest setHTTPBody:driveItemData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
DriveItem driveItem = new DriveItem();
driveItem.id = "123456!87";
graphClient.drive().bundles("{bundle-id}").children()
.buildRequest()
.post(driveItem);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Response
The following is an example of the response.
HTTP/1.1 204 No Content