Refresh Session
-
- 2 minutes to read
-
Use this API to refresh an existing workbook session.
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) |
Files.ReadWrite |
Delegated (personal Microsoft account) |
Not supported. |
Application |
Not supported. |
HTTP request
POST /workbook/refreshSession
workbook-session-id: {session-id}
Name |
Description |
Authorization |
Bearer {token}. Required. |
workbook-session-id |
Workbook session Id to be refreshed |
Request body
This API does not require any request body.
Response
If successful, this method returns 204 No Content
response code.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/refreshSession
Content-type: application/json
workbook-session-id: {session-id}
Content-length: 0
{
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Me.Drive.Items["{id}"].Workbook
.RefreshSession()
.Request()
.Header("workbook-session-id","{session-id}")
.PostAsync();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const refreshSession = {
};
let res = await client.api('/me/drive/items/{id}/workbook/refreshSession')
.post(refreshSession);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/drive/items/{id}/workbook/refreshSession"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"{session-id}" forHTTPHeaderField:@"workbook-session-id"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
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];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
IGraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new HeaderOption("workbook-session-id", "{session-id}"));
graphClient.me().drive().items("{id}").workbook()
.refreshSession()
.buildRequest( requestOptions )
.post();
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
Note that workbook-session-id header is required.
Response
Here is an example of the response.
HTTP/1.1 204 No Content