我正在尝试使用 SPFx 附带的 AadHttpClient 库连接到由 Azure AD 中的应用注册保护的自定义 API。
但是,当我在工作台、SharePoint Online(在租户_layouts 中)中运行 Web 部件时,我在控制台中收到一条错误消息,指出该功能是实验性的。
错误:请求的操作是当前环境不支持的实验性功能的一部分。
据我所知 this article ,应该是一般版本。
When connecting to Azure AD-secured APIs, we recommend that you use the MSGraphClient and AadHttpClient classes, which are now generally available. For more information about the recommended models, see Connect to Azure AD-secured APIs in SharePoint Framework solutions and Use the MSGraphClient to connect to Microsoft Graph.
当我进入 SP 管理站点中的 API 管理页面时,我会看到一个弹出窗口,指出
***Access to Azure Active Directory resources using the SharePoint Framework will be available soon.
所以我有点困惑。
我还在 API 管理页面上收到一条错误消息:..
A null value was found with the expected type 'Edm.String[Nullable=False]'. The expected type 'Edm.String[Nullable=False]' does not allow null values.
当我尝试在 PowerShell 中运行时,我也遇到了同样的错误
Get-SPOTenantServicePrincipalPermissionRequests
我不能 100% 确定我了解 API 管理页面的相关性 - 管理员是否只需为 Web 部件批准一次,然后所有用户就可以使用了?
最佳答案
我也遇到了同样的问题。 github线程可以找到here 。对我来说解决这个问题的方法是添加我用作网站集管理员的帐户。
Connect-SPOService
Set-SPOUser -Site https://TENANT-admin.sharepoint.com -IsSiteCollectionAdmin $True -LoginName yourLoginName
关于azure - SharePoint 框架 AadHttpClient - 操作是实验性功能的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52208310/