【发布时间】:2022-04-20 16:54:37
【问题描述】:
我正在尝试使用 Sharepoint Online CSOM 和 PnP 使用 oAuth(Azure AD 应用程序)进行共享点身份验证,但它给出了错误“字典中不存在给定的密钥。”。我已经创建了 Azure AD 应用程序并在该应用程序中添加了 Sharepoint AllSite.FullControl 的 API 权限。
我正在使用试用共享点租户。
这是我的代码 sn-ps:
ClientContext _sharepointContaxt = null;
string Username = [Username];
string Password = [Password];
string AppId="67b1845e-88b1-4e6c-b7db-7f1d3abe3b06";
Uri site = new Uri([Sharepoint_site_url]);
using (var authenticationManager = new AuthenticationManager("67b1845e-88b1-4e6c-b7db-7f1e3aae3a06"))
using (_sharepointContaxt = authenticationManager.GetContext(site, Username, SecurePassword(Password)))
{
Web web = _sharepointContaxt.Web;
_sharepointContaxt.Load(web);
_sharepointContaxt.ExecuteQuery();
}
【问题讨论】: