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)
Files.ReadWrite
Not available.
Delegated (personal Microsoft account)
Files.ReadWrite
Not available.
Application
Not supported.
Not supported.
HTTP request
POST /me/drive/items/{id}/workbook/tables/{id|name}/sort/apply
POST /me/drive/root:/{item-path}:/workbook/tables/{id|name}/sort/apply
POST /me/drive/items/{id}/workbook/worksheets/{id|name}/tables/{id|name}/sort/apply
POST /me/drive/root:/{item-path}:/workbook/worksheets/{id|name}/tables/{id|name}/sort/apply
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Drives.Item.Items.Item.Workbook.Tables.Item.Sort.Apply;
using Microsoft.Graph.Models;
var requestBody = new ApplyPostRequestBody
{
Fields = new List<WorkbookSortField>
{
new WorkbookSortField
{
Key = 99,
SortOn = "sortOn-value",
Ascending = true,
Color = "color-value",
DataOption = "dataOption-value",
Icon = new WorkbookIcon
{
Set = "set-value",
Index = 99,
},
},
},
MatchCase = true,
Method = "method-value",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Workbook.Tables["{workbookTable-id}"].Sort.Apply.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.drives.item.items.item.workbook.tables.item.sort.apply.ApplyPostRequestBody applyPostRequestBody = new com.microsoft.graph.drives.item.items.item.workbook.tables.item.sort.apply.ApplyPostRequestBody();
LinkedList<WorkbookSortField> fields = new LinkedList<WorkbookSortField>();
WorkbookSortField workbookSortField = new WorkbookSortField();
workbookSortField.setKey(99);
workbookSortField.setSortOn("sortOn-value");
workbookSortField.setAscending(true);
workbookSortField.setColor("color-value");
workbookSortField.setDataOption("dataOption-value");
WorkbookIcon icon = new WorkbookIcon();
icon.setSet("set-value");
icon.setIndex(99);
workbookSortField.setIcon(icon);
fields.add(workbookSortField);
applyPostRequestBody.setFields(fields);
applyPostRequestBody.setMatchCase(true);
applyPostRequestBody.setMethod("method-value");
graphClient.drives().byDriveId("{drive-id}").items().byDriveItemId("{driveItem-id}").workbook().tables().byWorkbookTableId("{workbookTable-id}").sort().apply().post(applyPostRequestBody);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.drives.item.items.item.workbook.tables.item.sort.apply.apply_post_request_body import ApplyPostRequestBody
from msgraph.generated.models.workbook_sort_field import WorkbookSortField
from msgraph.generated.models.workbook_icon import WorkbookIcon
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = ApplyPostRequestBody(
fields = [
WorkbookSortField(
key = 99,
sort_on = "sortOn-value",
ascending = True,
color = "color-value",
data_option = "dataOption-value",
icon = WorkbookIcon(
set = "set-value",
index = 99,
),
),
],
match_case = True,
method = "method-value",
)
await graph_client.drives.by_drive_id('drive-id').items.by_drive_item_id('driveItem-id').workbook.tables.by_workbook_table_id('workbookTable-id').sort.apply.post(request_body)