Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Browse the files and folders within the sharePointBrowseSession.
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) | BackupRestore-Restore.ReadWrite.All | Not available. |
| Delegated (personal Microsoft account) | Not supported. | Not supported. |
| Application | BackupRestore-Restore.ReadWrite.All | Not available. |
Note
In the delegated flow, only users with the SharePoint Backup Administrator role can access this API.
HTTP request
POST /solutions/backupRestore/sharePointBrowseSessions/{sharePointBrowseSessionId}/browse
Request headers
| Name | Description |
|---|---|
| Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Request body
To get top browsable locations, in the request body, supply an empty JSON object {}.
To browse a specific scope, in the request body, supply a JSON representation of the following parameters.
| Parameter | Type | Description |
|---|---|---|
| browseLocationItemKey | String | The item key of the location that you want to browse. Optional. |
| browseResourceType | browsableResourceType | The type of the browsable location. The possible values are none, site, documentLibrary, folder, and unknownFutureValue. Optional. |
| filter | String | Contains the search expression. Optional. |
| optimizedBrowse | Boolean | Indicates whether to use the optimized browse flow to directly retrieve files and folders when the artifact has a single site and single document library. Optional. Returns 409 Conflict if multiple sites or document libraries exist. |
| orderBy | browseQueryOrder | Specifies the order by which response should be ordered. Optional. |
The following table shows examples of possible formats for the filter expression. The filter is supported only on the name property.
| Property | Operator | Example |
|---|---|---|
name |
-contains |
(name -contains 'contoso') |
Response
If successful, this function returns a 200 OK response code and a browseQueryResponseItem collection in the response body.
When optimizedBrowse is true but the artifact contains multiple sites or document libraries, this method returns a 409 Conflict response code. In this case, use the regular browse flow.
Examples
Example 1: Get top browsable locations
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/solutions/backupRestore/sharePointBrowseSessions/m_RtZ8BiiUXOK69cuN6gwubfm9_yeVlDg8s6hci01_cVOAE/browse
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.browseQueryResponseItem)",
"@odata.count": 1,
"value": [
{
"itemKey": "f3846f8d-80a6-4480-ae20-5966ebdf2009,26380145-c085-4772-b5ef-94de6bc9447e",
"name": "Communication site",
"webUrl": "https://contoso.sharepoint.com",
"type": "site"
}
]
}
Example 2: Browse a specific resource
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/solutions/backupRestore/sharePointBrowseSessions/m_RtZ8BiiUXOK69cuN6gwubfm9_yeVlDg8s6hci01_cVOAE/browse
Content-Type: application/json
{
"browseLocationItemKey": "f3846f8d-80a6-4480-ae20-5966ebdf2009,26380145-c085-4772-b5ef-94de6bc9447e",
"browseResourceType": "site"
}
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.browseQueryResponseItem)",
"@odata.count": 10,
"@odata.nextLink": "https://graph.microsoft.com/beta/solutions/backupRestore/sharePointBrowseSessions/m_RtZ8BiiUXOK69cuN6gwubfm9_yeVlDg8s6hci01_cVOAE/browse?$skiptoken=eyJ0eXBlIjoiRm9sZGVyIiwiZmlsdGVyIjoiIiwiaXRlbWtleSI6ImJiMjgxZjcyLWY3Y2MtNDM3OS1iMjk1LTBjNjEyNTMxMjdhZiw3NzA0MmZjYi03NGUzLTQ2YWEtOGE1My0wNWY5NzM5ZWJkZjQsMDdhNzEyNWEtMTVlMy00MDJkLWJlYjktZWU2NTQwZjdmNWJjLGE3MWUyZWZjLThmNTctNGIzOS1hNGE5LTNhNGU2MmZkMDM3YiIsInNraXB0b2tlbiI6IlVHRm5aV1E5VkZKVlJTWndYMU52Y25SQ1pXaGhkbWx2Y2owd0puQmZTVVE5TVRZNUpsSnZiM1JHYjJ4a1pYSTlKVEptY0dWeWMyOXVZV3dsTW1aMWMyVnlNQ1UxWm1FNE16QmxaR0ZrT1RBMU1EZzBPVzFoYm1selpIWXdOeVUxWm05dWJXbGpjbTl6YjJaMEpUVm1ZMjl0SlRKbVJHOWpkVzFsYm5SekpUSm1ZWEJwIn0",
"value": [
{
"itemKey": "bb281f72-f7cc-4379-b295-0c61253127af,77042fcb-74e3-46aa-8a53-05f9739ebdf4,07a7125a-15e3-402d-beb9-ee6540f7f5bc,2db4d4a9-7a10-409d-acfb-136101b43ba8",
"name": "Report.docx",
"webUrl": "https://contoso.sharepoint.com/Shared Documents/Report.docx",
"type": "file",
"itemsCount": 0,
"sizeInBytes": "2594",
"createdDateTime": "2024-06-01T10:00:00Z",
"createdBy": {
"user": {
"id": "6ebb65c7-0b69-4f4a-8108-12f29da1a7b7"
}
},
"lastModifiedDateTime": "2024-06-02T15:30:00Z",
"lastModifiedBy": {
"user": {
"id": "6ebb65c7-0b69-4f4a-8108-12f29da1a7b7"
}
}
},
{
"itemKey": "bb281f72-f7cc-4379-b295-0c61253127af,77042fcb-74e3-46aa-8a53-05f9739ebdf4,07a7125a-15e3-402d-beb9-ee6540f7f5bc,e3cca06d-b45d-4e98-bd16-c57a4563776f",
"name": "Reports",
"webUrl": "https://contoso.sharepoint.com/Shared Documents/Reports",
"type": "folder",
"itemsCount": 12,
"sizeInBytes": "45820",
"createdDateTime": "2024-05-20T08:15:00Z",
"createdBy": {
"user": {
"id": "6ebb65c7-0b69-4f4a-8108-12f29da1a7b7"
}
},
"lastModifiedDateTime": "2024-06-02T11:45:00Z",
"lastModifiedBy": {
"user": {
"id": "6ebb65c7-0b69-4f4a-8108-12f29da1a7b7"
}
}
}
]
}
Example 3: Browse items with nextLink.
We get the nextLink in the response of first POST api call as shown above and subsequent pages are fetched using the nextlink.
Request
The following example shows a request.
GET https://graph.microsoft.com/beta/solutions/backupRestore/sharePointBrowseSessions/m_RtZ8BiiUXOK69cuN6gwubfm9_yeVlDg8s6hci01_cVOAE/browse?$skiptoken=nextFetchToken
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.browseQueryResponseItem)",
"@odata.count": 10,
"value": [
{
"itemKey": "bb281f72-f7cc-4379-b295-0c61253127af,77042fcb-74e3-46aa-8a53-05f9739ebdf4,07a7125a-15e3-402d-beb9-ee6540f7f5bc,b74f9233-27a7-4d49-a723-c9a4ab717d2d",
"name": "Report.docx",
"webUrl": "https://contoso.sharepoint.com/Shared Documents/Report.docx",
"type": "file",
"itemsCount": 0,
"sizeInBytes": "2484",
"createdDateTime": "2024-06-01T10:00:00Z",
"createdBy": {
"application": {
"id": "5110d9f2-bfb1-4dec-9712-0ab11af28e1c"
}
},
"lastModifiedDateTime": "2024-06-02T15:30:00Z",
"lastModifiedBy": {
"application": {
"id": "5110d9f2-bfb1-4dec-9712-0ab11af28e1c"
}
}
},
{
"itemKey": "bb281f72-f7cc-4379-b295-0c61253127af,77042fcb-74e3-46aa-8a53-05f9739ebdf4,07a7125a-15e3-402d-beb9-ee6540f7f5bc,4f20a6c4-c999-4ee8-9552-ca6a7fc46edf",
"name": "Reports",
"webUrl": "https://contoso.sharepoint.com/Shared Documents/Reports",
"type": "folder",
"itemsCount": 12,
"sizeInBytes": "45820",
"createdDateTime": "2024-05-20T08:15:00Z",
"createdBy": {
"application": {
"id": "5110d9f2-bfb1-4dec-9712-0ab11af28e1c"
}
},
"lastModifiedDateTime": "2024-06-02T11:45:00Z",
"lastModifiedBy": {
"application": {
"id": "5110d9f2-bfb1-4dec-9712-0ab11af28e1c"
}
}
}
]
}
Example 4: Browse items by using the optimized browse flow
When the browse session targets a single site that contains a single document library, set optimizedBrowse to true to directly get the files and folders in the artifact without specifying browseResourceType.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/solutions/backupRestore/sharePointBrowseSessions/m_RtZ8BiiUXOK69cuN6gwubfm9_yeVlDg8s6hci01_cVOAE/browse
Content-Type: application/json
{
"optimizedBrowse": true
}
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.browseQueryResponseItem)",
"@odata.count": 3,
"value": [
{
"itemKey": "a535851e-9fc6-4eb1-90ab-2955fd9117b5,2a8b7eaf-092a-4561-a25a-998ad2e5142e,38eec3f1-b879-44a6-8ae6-05bd46ed4b3d,f1a2b3c4-5678-90ab-cdef-1234567890ab",
"name": "Documents",
"webUrl": "https://contoso.sharepoint.com/sites/site1/Shared%20Documents",
"type": "folder"
},
{
"itemKey": "a535851e-9fc6-4eb1-90ab-2955fd9117b5,2a8b7eaf-092a-4561-a25a-998ad2e5142e,38eec3f1-b879-44a6-8ae6-05bd46ed4b3d,a1b2c3d4-5678-90ab-cdef-0987654321ba",
"name": "Site Assets",
"webUrl": "https://contoso.sharepoint.com/sites/site1/SiteAssets/Folder1",
"type": "folder"
},
{
"itemKey": "a535851e-9fc6-4eb1-90ab-2955fd9117b5,2a8b7eaf-092a-4561-a25a-998ad2e5142e,38eec3f1-b879-44a6-8ae6-05bd46ed4b3d,b2c3d4e5-6789-01ab-cdef-9876543210ba",
"name": "Presentation",
"webUrl": "https://contoso.sharepoint.com/sites/site1/SiteAssets/Presentation.ppt",
"type": "file"
}
]
}
Example 5: Search items by using the optimized browse flow with a filter
The following example uses the optimized browse flow together with a filter to return only the items whose name contains Folder.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/solutions/backupRestore/sharePointBrowseSessions/m_RtZ8BiiUXOK69cuN6gwubfm9_yeVlDg8s6hci01_cVOAE/browse
Content-Type: application/json
{
"optimizedBrowse": true,
"filter": "(name -contains 'Folder')"
}
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
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#Collection(microsoft.graph.browseQueryResponseItem)",
"@odata.count": 2,
"value": [
{
"itemKey": "a535851e-9fc6-4eb1-90ab-2955fd9117b5,2a8b7eaf-092a-4561-a25a-998ad2e5142e,38eec3f1-b879-44a6-8ae6-05bd46ed4b3d,a1b2c3d4-5678-90ab-cdef-0987654321ba",
"name": "Folder1",
"webUrl": "https://contoso.sharepoint.com/sites/site1/SiteAssets/Folder1",
"type": "folder"
},
{
"itemKey": "a535851e-9fc6-4eb1-90ab-2955fd9117b5,2a8b7eaf-092a-4561-a25a-998ad2e5142e,38eec3f1-b879-44a6-8ae6-05bd46ed4b3d,b2c3d4e5-6789-01ab-cdef-9876543210ba",
"name": "FolderFile.txt",
"webUrl": "https://contoso.sharepoint.com/sites/site1/SiteAssets/Folder1/FolderFile.txt",
"type": "file"
}
]
}