带有基于声明的身份验证的Project Server In前提2016 CSOM代码

时间:2018-10-24 09:55:56

标签: csom

我们的一位客户在其Project Server 2016内部环境中启用了ADFS。我们在自定义应用程序中使用CSOM操作,由于此更改,CSOM操作失败。

对于基于ADFS声明的身份验证,我们需要传递Authenticated cookie。有人可以帮助我们如何使用CSOM代码添加经过身份验证的Cookie。

用于获取项目列表的现有CSOM代码:

public static void GetProjectListInpremise()
        {
            NetworkCredential net = null;

            Console.WriteLine("Read Project Online Started ..");
            string PWAOnlineUrl = ConfigurationManager.AppSettings     ["pwaInpremiseUrl"];
            string userName = ConfigurationManager.AppSettings["pwaInpremiseUser"];
            string password = ConfigurationManager.AppSettings["pwaInpremiseUserPwd"];
            string domain = ConfigurationManager.AppSettings["pwaInpremiseDomian"];
            net = new NetworkCredential(userName, password, domain);

            ProjectContext projContext = null;
            projContext = new ProjectContext(PWAOnlineUrl);
           // projContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
            projContext.Credentials = net;
            projContext.Load(projContext.Projects);
            projContext.ExecuteQuery();

            Console.WriteLine("Read Project Execute Query Successful..");

            foreach (PublishedProject pubProj in projContext.Projects)

            {

                Console.WriteLine("Project Name :" + pubProj.Name);

            }
            Console.ReadLine();

        }

0 个答案:

没有答案
相关问题