简体   繁体   English

手动编辑 Excel 365 并用图形读取 api 延迟

[英]Editing Excel 365 by hand and reading with graph api latency

I have an excel on line documents that can be edited by users in the Excel 365 web application.我有一个 excel 在线文档,用户可以在 Excel 365 web 应用程序中进行编辑。

I have an application that read this excel file with the graph api.我有一个应用程序读取这个 excel 文件和图形 api。

I have successfully managed to read the data from the file but when a user change the excel file and Excel says it has been saved, if I read the file immediately with my application I have old data.我已经成功地从文件中读取数据,但是当用户更改 excel 文件并且 Excel 表示它已保存时,如果我立即使用我的应用程序读取文件,我得到的是旧数据。

I have to wait for 30s to have the updated data.我必须等待 30 秒才能获得更新的数据。 Is there anything I can do to avoid this latency.我能做些什么来避免这种延迟。

Here is my call to get the data:这是我获取数据的电话:

var range = await _graphClient.Drives[_driveId].Items[_itemId].Workbook.Worksheets[workseetName]
            .Range(rangeAddress).UsedRange(true)
            .Request()
            .GetAsync();

I posted a similar question on the graph API github repo.我在图表 API github repo 上发布了一个类似的问题。 They responded here: https://github.com/microsoftgraph/msgraph-cli/issues/215#issuecomment-1379391739他们在这里回复: https://github.com/microsoftgraph/msgraph-cli/issues/215#issuecomment-1379391739

They suggest using the etag property to determine whether the workbook has changed since that last access.他们建议使用 etag 属性来确定自上次访问以来工作簿是否已更改。 https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0 https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0

They also suggest using the Excel session. https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0#sessions-and-persistence他们还建议使用 Excel session。https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0#sessions-and-persistence

However in my personal testing the session method didn't fix the delay in excel saving the data in the backend.但是在我的个人测试中,session 方法并没有修复 excel 中保存数据在后端的延迟。

They also mentioned: "I cannot guarantee that these will work. I don't think this API was designed with real-time co-authoring in mind."他们还提到:“我不能保证这些会起作用。我不认为这个 API 是为实时共同创作而设计的。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM