c# - 多因素认证获取Sharepoint ClientContext后如何获取ProjectContext?
问题描述
对于启用了 MFA 的客户端,我想通过 CSOM/C# 与 Project Onine 进行交互。通过下面的代码片段,我可以通过我认为的共享点 MFA(调试器通过这些行),但是我如何获得 Project Online 的上下文?强制转换失败(我想我从错误消息中理解为什么),那我该怎么办?
private static bool GetMultiFactorAuthCookie(string pwaPath)
{
bool error = false;
var authManager = new AuthenticationManager();
ClientContext sharepointClientContext = authManager.GetWebLoginClientContext(pwaPath);
web = sharepointClientContext.Web;
user = web.CurrentUser;
sharepointClientContext.Load(web);
sharepointClientContext.Load(user);
sharepointClientContext.ExecuteQuery();
ProjectContext projContext = sharepointClientContext.CastTo<ProjectContext>(sharepointClientContext);
return !error;
}
调试器告诉我
无法从“Microsoft.SharePoint.Client.ClientContext”转换为“Microsoft.SharePoint.Client.ClientObject”
解决方案
推荐阅读
- jmeter - 在摘要报告侦听器文件名中使用时间函数
- android - 在调试模式下将 minifyEnabled 设置为 true 后,api 调用无法正常工作
- typescript - 打字稿扩展 HTMLIFrameElement
- ruby-on-rails - 范围内的资源有错误的更新路径
- authentication - 无法在 nuxt js 中读取未定义的属性“帖子”
- forms - 引导表单验证禁用我的单选按钮
- comparison - RocksDB:使用自定义比较器时比较太多
- kubernetes - 关于: CreateContainerError
- html - 产品轮播,在手机上展示一件商品
- mulesoft - Mulesoft 中的全局变量