microsoft-graph-api - 在 Excel 查询中使用 Microsoft Graph 刷新令牌
问题描述
我正在使用 MS Excel 获取团队中的所有班次(来自 MS Teams)。我在 Azure 数据库中创建了一个 API,它能够使用 Bearer 令牌成功检索此数据。但是,此 Bearer 令牌会在 60 分钟后过期。因此,我可以使用刷新令牌(通过将 offline_access 范围添加到我的请求中来接收)。
Excel 中的当前查询如下所示:
let
Source = Json.Document(Web.Contents("https://graph.microsoft.com/v1.0/teams/{{team-id}}/schedule/shifts?$filter=sharedShift/startDateTime ge " & Excel.CurrentWorkbook(){[Name="periodestart"]}[Content]{0}[Column1] & " and sharedShift/endDateTime le " & Excel.CurrentWorkbook(){[Name="periodeeind"]}[Content]{0}[Column1], [Headers=[Authorization="Bearer 12345...."]])),
value = Source[value],
#"Converted to Table" = Table.FromList(value, Splitter.SplitByNothing(), null, null, ExtraValues.Error)
in
#"Converted to Table"
我从 Postman 生成 Bearer 令牌,然后我可以在 Excel 中使用 1 小时。当然,这不是面向未来的,因为我希望能够随时在 Excel 中刷新我的查询以获取这些班次,并且任何使用 Excel 文件的用户都可以使用,这在令牌过期时是不可能的。因此,我的问题是:如何在我的 Excel 查询中使用刷新令牌,以便在用户想要更新查询时自动提供新的 Bearer 令牌?
谢谢!
解决方案
推荐阅读
- html - 为什么浏览器最小化时侧边栏的高度会发生变化?
- android - Android位图到WebRtc I420帧损坏
- angular - RxJS:让 Observables 仅在前一个 Observable 完成后才发出值
- airflow - 气流服务器缺少 git
- python - RuntimeError: Unsupported image type, must be 8bit gray or RGB image
- powershell - 替换文件名powershell中文本前的一个字符
- reactjs - Firebase 数据库不是 ReactJS 应用程序中的函数错误
- visual-studio-code - VSCodium 在 Mac OS Mojave 中的“escape”键上随机崩溃。我怎样才能找到问题?
- c# - 查找 tfs 变更集中更改的功能
- python-3.x - python中fun1和fun1()的区别