Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

StackOverflow Point

StackOverflow Point Navigation

  • Web Stories
  • Badges
  • Tags
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Web Stories
  • Badges
  • Tags
Home/ Questions/Q 4064
Alex Hales
  • 0
Alex HalesTeacher
Asked: June 3, 20222022-06-03T10:59:34+00:00 2022-06-03T10:59:34+00:00

Microsoft Graph APi Excel : Session creation with long-running operation pattern (when and how to do it)

  • 0

[ad_1]

I am using Microsoft graph API to create/update/delete rows in Excel files
So most of the time my API will have to do operation with large excel files. So as document say we have to use workbook-session-id for better performance i tried using the same and the performance is as expected.

But as per the document below it also says that “Sometime to get the session id it may take indeterminate to complete Microsoft Graph also provides a long running operations pattern”
https://docs.microsoft.com/en-us/graph/api/workbook-createsession?view=graph-rest-1.0&tabs=http

But when i try to use the same i get following error:

  1. Below call gave me expected response header

request :

POST https://graph.microsoft.com/v1.0/me/drive/items/{drive-item-id}/workbook/worksheets({id})/createSession
Prefer: respond-async
Content-type: application/json
{
“persistChanges”: true
}

response:

HTTP/1.1 202 Accepted
Location: https://graph.microsoft.com/v1.0/me/drive/items/{drive-item-id}/workbook/operations/{operation-id}

  1. As recommended I made a polling request every 30 seconds to the url i got in location header from step1

I tried to do this many times and i never got success response, below is the sequence of error i get when i poll the request every 30 sec

Initially for few minutes i get status failed:
{“@odata.context”:”https://graph.microsoft.com/v1.0/$metadata#users(‘5cfd4699-1356-45c6-ab63-8c804020285c’)/drive/root/workbook/operations/$entity”,”id”:”8a780746-6142-4282-8af0-ffa26985fd98″,”status”:”failed”,”error”:{“code”:”serviceUnavailable”,”message”:”The service is not available. Please try your request again.”,”innerError”:{“code”:”transientFailure”,”message”:”The request failed
due to a transient error. Please try your request again after the cooldown duration specified by Retry-After header.”,”innerError”:{“code”:”CoauthSessionTerminated”,”message”:”The workbook needs to be updated. Click OK to continue.”}}}}

After sometime for i get status as running:

{“@odata.context”:”https://graph.microsoft.com/v1.0/$metadata#users(‘5cfd4699-1356-45c6-ab63-8c804020285c’)/drive/root/workbook/operations/$entity”,”id”:”8a780746-6142-4282-8af0-ffa26985fd98″,”status”:”running”}
{“@odata.context”:”https://graph.microsoft.com/v1.0/$metadata#users(‘5cfd4699-1356-45c6-ab63-8c804020285c’)/drive/root/workbook/operations/$entity”,”id”:”8a780746-6142-4282-8af0-ffa26985fd98″,”status”:”running”}

After sometime i get error “LostDepartedOperation”

{“error”:{“code”:”LostDepartedOperation”,”message”:”We’re sorry. We ran into a problem completing your request.”,”innerError”:{“code”:”notFoundUncategorized”,”message”:”The requested resource cannot be found.”,”innerError”:{“code”:”LostDepartedOperation”,”message”:”We’re sorry. We ran into a problem completing your request.”},”date”:”2022-06-02T09:14:58″,”request-id”:”43e48788-f225-45b3-97e1-a8ba1950ee53″,”client-request-id”:”43e48788-f225-45b3-97e1-a8ba1950ee53″}}}
PS C:\Users\AVVM4J744\Desktop\testingapp>

I never got a status as “succeeded” as expected 🙁

Below are my queries:

  1. Is my above implementation correct or am i doing something wrong ?
  2. When and how should i decide to use “long-running operation pattern” programmatically

Thanks

[ad_2]

  • 0 0 Answers
  • 5 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report
Leave an answer

Leave an answer
Cancel reply

Browse

Sidebar

Ask A Question

Related Questions

  • xcode - Can you build dynamic libraries for iOS and ...

    • 0 Answers
  • bash - How to check if a process id (PID) ...

    • 8056 Answers
  • database - Oracle: Changing VARCHAR2 column to CLOB

    • 1842 Answers
  • What's the difference between HEAD, working tree and index, in ...

    • 1924 Answers
  • Amazon EC2 Free tier - how many instances can I ...

    • 0 Answers

Stats

  • Questions : 43k

Subscribe

Login

Forgot Password?

Footer

Follow

© 2022 Stackoverflow Point. All Rights Reserved.

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.