Microsoft Graph API Sharepoint Excel delay when using the usedRange endpoint - excel

When using the Microsoft Graph API to query the contents of a worksheet via the usedRange endpoint:
https://learn.microsoft.com/en-us/graph/api/worksheet-usedrange?view=graph-rest-1.0&tabs=http
When I edit a cell on the spreadsheet via the browser app and then call that endpoint, the contents of that cell isn't present until after a small delay, usually around 5s. In the worksheet itself the header says that it has been saved, however that isn't immediately present when called via the endpoint.
Is there a method to guarantee that when calling the Graph API endpoint that I'm getting the absolute latest contents, or is there a way to force a save via GraphAPI endpoints before querying for the contents of a worksheet?
I tried refreshSession but that had the same issue, I expect that as soon as it says content saved on the excel sharepoint browser app, the results will be the same as the content returned by usedRange

Related

how to get modified rows of a SharePoint Excel file to Power Automate Cloud Flow using the Excel Rest API or any other method other than macro files?

I want to get modified rows from sharepoint excel to my power automate cloud flow. If we can get data of excel catch up events from a Rest API, That will easily solve my problem.(Please Refer the image attached for more info.) But I was unable to find a Rest API or Proper documentation for Excel File Rest APIs.
Requirement: I want to show the modified rows for approval.
Sharepoint Excel Rest APIs and version history.

Azure Logic App Get Targeted Worksheet row values

Scenario. I have Sheet1 and Sheet2, I only want to get the Sheet2 data cause I will be converting it to HTML. However I want to do it without signing to Excel's OneDrive or using the excel action.
The reason why I can't login to Excel's OneDrive because of multi-factor authentication/credentials issue.
Is there any way I can get the worksheet values using the file content from get file OneDrive flow and not signing in to excel business flow?
To use OneDrive in Azure logic app, you must first create a connection to it, otherwise you cannot operate it.

Passing data from office JS storage to Queries and Connections

I have an Auth flow in my add-in that returns API token which I want later to use in my Queries and Connections (Power BI/Power Query). How can I safely transfer/read the token from Office JS storage to be usable on Power Query Editor?
Right now I created a custom excel function (formula) that returns this token, but those functions can be used only in Cells. There are two problems with that:
The API token will be stored in a cell and thus preserved together with the spreadsheet which is not OK
The power query might not expect the cell to be updated asynchronously as the JS functions are

Microsoft Teams: Provide 'Edit in Teams' for Sharepoint Documents in Custom Tab

We are writing a document organization system as a Custom Tab within Microsoft Teams and we are trying to replicate the 'Edit in Teams' option that´s provided by Microsoft Teams on the Files tab but it seems that we are unable to replicate the functionality. We are storing files within Sharepoint and have an edit URL, but we are unable to iframe this link due to CORS issues and can only open this link in a new browser. Does anyone have any thoughts on how we can open office documents within the teams client from a custom tab other than opening as a new window which means users have to keep switching in and out of Microsoft Teams.
By looking at what Microsoft teams is doing via the network requests, when you select ´Edit in Teams' it is getting hold of an wacUrlEdit link which appears to be iframeable which for example begins with https://euc-word-edit.officeapps.live.com/we/wordeditorframe.aspx?ui=en, however we can´t get hold of this wacUrlEdit link as it generated using an access token from https://api.spaces.skype.com, which according to https://stackoverflow.com/users/4406395/bill-bliss-msft on How to get an Azure Active Directory access token for https://api.spaces.skype.com isn´t publicly available, it´s only intended for the teams client. Fyi.. It also seems that Teams doesn´t IFrame this wacUrlEdit, but opens up a new url (at least in the web browser) via https://teams.microsoft.com/_#/docx/viewer/teams
I have read about WOPI host implementation, but this does seem like a lot of work to solve this and not totally sure this is the correct option considering these files are stored in Sharepoint Online.

Power BI Data Source with Refresh ability

I am trying to setup a data set in Power BI which can be refreshed on a need basis or scheduled to refresh.
I am uploading an excel workbook which has a power query.
the power query is connecting to Replicon Service to get data via service. the query looks as below:
Source = Web.Contents(
"https://na2.replicon.com/services/ClientService1.svc/GetActiveClients",
[
Headers=
[
#"Authorization"="Bearer *ValidToken*",
#"Accept"="application/json",
#"Content-Type"="application/json"
],
Content=Text.ToBinary("{}")
]
)
the request is a POST operation and hence Content field is used in Web.Contents Options argument. Authentication is via Bearer token.
Data source setting is Anonymous Credentials with privacy Level set to None.
This works fine and I am able to retrieve the results and even refresh form within workbook.
Once I upload this to PowerBI and attempt to refresh the newly created Dataset it says:
You cannot refresh yet because you need to provide valid credentials for your data sources in the dataset.
So I go to Manage Data sources. Click Edit Credentials. Select "Anonymous" Authentication method and click on Sign In and it says "Login Failed".
Why is that so? It appears that the Headers are lost when I upload the Excel workbook. How can I accomplish this? Is there any alternate ways of being able to set up a Data Set which can be refreshed - the source being a web service?
this is what i ended up doing finally.
my scenario first:
my requests are POST
Authentication is via bearer token which needed to be passed via Request Header. this was the requirement of the replicon service i am trying to invoke which i couldn't change
the dataset that is created in PowerBI needed to be refreshable.
Since i couldn't get it to work directly from inside PowerBI i introduced an intermediate layer. this would interpret GET requests from PowerBI. process the token from query string. accept the service and operation also as query string parameters. it would then create POST request to the Real Service (replicon services in my case). the service name and operation names were also picked up from request URL. the token was pushed as part of request header
so the request from PowerBI would look as PowerBI needed i.e.
Web.Contents("https://intermediatelayer.com?access_token="*validtoken*"&ServiceName="ClientService"&Operation="GetActiveClients"")
not an ideal solution but works.
Manage Data Sources is validating the Anonymous credentials with a GET request to the URL without the hardcoded headers, like you suggest. It's basically running
Web.Contents("https://na2.replicon.com/services/ClientService1.svc/GetActiveClients")
which fails with "(405): Method Not Allowed", and so Manage Data Sources thinks the credentials are wrong.
Short of making the service reply with a success response for the above M, I don't see any way to set up refresh on this mashup.

Resources