Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Get a list of all the bundles in a user's drive.
This API is available in the following national cloud deployments.
Global service |
US Government L4 |
US Government L5 (DOD) |
China operated by 21Vianet |
✅ |
❌ |
❌ |
✅ |
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type |
Least privileged permissions |
Higher privileged permissions |
Delegated (work or school account) |
Not supported. |
Not supported. |
Delegated (personal Microsoft account) |
Files.Read |
Files.ReadWrite, Files.Read.All, Files.ReadWrite.All |
Application |
Not supported. |
Not supported. |
HTTP request
GET /drive/bundles
Optional query parameters
This method supports the $filter
OData query parameters to help customize the response.
You can't use the expand=children
query parameter to list bundles.
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a collection of bundle objects in the response body.
For information about error responses, see Microsoft Graph error responses and resource types.
Examples
Example 1: List all bundles in a drive
To request an enumeration of all bundles defined in the drive, you can make a request to the bundles collection without any parameters.
Request
The following example shows a request.
GET https://graph.microsoft.com/beta/drive/bundles
// 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.Drives["{drive-id}"].Bundles.GetAsync();
mgc-beta drives bundles list --drive-id {drive-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
//other-imports
)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
bundles, err := graphClient.Drives().ByDriveId("drive-id").Bundles().Get(context.Background(), nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DriveItemCollectionResponse result = graphClient.drives().byDriveId("{drive-id}").bundles().get();
const options = {
authProvider,
};
const client = Client.init(options);
let bundles = await client.api('/drive/bundles')
.version('beta')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->drives()->byDriveId('drive-id')->bundles()->get()->wait();
Import-Module Microsoft.Graph.Beta.Files
Get-MgBetaDriveBundle -DriveId $driveId
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta 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.drives.by_drive_id('drive-id').bundles.get()
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "0123456789abc",
"name": "Vacation photo album",
"bundle": {
"childCount": 1,
"album": { }
}
},
{
"id": "0120310201abd",
"name": "Family shared files",
"bundle": {
"childCount": 1
}
}
],
"@odata.nextLink": "https://..."
}
Example 2: List all photo albums in a drive
To filter the list of bundles returned from a request to the bundles collection, you can use the filter
query string parameter to specify the type of bundle to return by checking for the existence of a facet on the bundle.
Request
The following example shows a request.
GET https://graph.microsoft.com/beta/drive/bundles?filter=bundle/album%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.Drives["{drive-id}"].Bundles.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "bundle/album ne null";
});
mgc-beta drives bundles list --drive-id {drive-id}
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphdrives "github.com/microsoftgraph/msgraph-beta-sdk-go/drives"
//other-imports
)
requestFilter := "bundle/album ne null"
requestParameters := &graphdrives.ItemBundlesRequestBuilderGetQueryParameters{
Filter: &requestFilter,
}
configuration := &graphdrives.ItemBundlesRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
bundles, err := graphClient.Drives().ByDriveId("drive-id").Bundles().Get(context.Background(), configuration)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
DriveItemCollectionResponse result = graphClient.drives().byDriveId("{drive-id}").bundles().get(requestConfiguration -> {
requestConfiguration.queryParameters.filter = "bundle/album ne null";
});
const options = {
authProvider,
};
const client = Client.init(options);
let bundles = await client.api('/drive/bundles?filter=bundle/album ne null')
.version('beta')
.filter('bundle/album ne null')
.get();
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Drives\Item\Bundles\BundlesRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new BundlesRequestBuilderGetRequestConfiguration();
$queryParameters = BundlesRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->filter = "bundle/album ne null";
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->drives()->byDriveId('drive-id')->bundles()->get($requestConfiguration)->wait();
Import-Module Microsoft.Graph.Beta.Files
Get-MgBetaDriveBundle -DriveId $driveId -Filter "bundle/album ne null"
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.drives.item.bundles.bundles_request_builder import BundlesRequestBuilder
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 = BundlesRequestBuilder.BundlesRequestBuilderGetQueryParameters(
filter = "bundle/album ne null",
)
request_configuration = RequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.drives.by_drive_id('drive-id').bundles.get(request_configuration = request_configuration)
Response
The following example shows the response. The response to a GET to the bundles endpoint is an array of driveItem resources with the bundle.
Because all bundles are items, you can use all the standard item operations on them.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "0123456789abc",
"name": "Vacation photo album",
"bundle": {
"childCount": 1,
"album": { }
}
},
{
"id": "120301010abcd",
"name": "Seattle Center event",
"bundle": {
"childCount": 4,
"album": { }
},
"tags": [
{
"name": "outside",
"autoTagged": { }
}
]
}
]
}