0
 SecureString secpassword1 = new SecureString();
            var username = "programer@dev7867.onmicrosoft.com";
            foreach (char c in password.ToCharArray()) secpassword1.AppendChar(c);
            using (ProjectContext projectContext = new ProjectContext("https://dev7867.sharepoint.com/sites/pwa"))
            {
                SharePointOnlineCredentials credentials = new SharePointOnlineCredentials(username, secpassword1);
                projectContext.Credentials = credentials;

                projectContext.Load(projectContext.Projects);
                projectContext.ExecuteQuery();
                foreach (var p in projectContext.Projects)
                {
                    Console.WriteLine(p.Name);
                }
            }

我想从 Microsoft Project Online 获取项目列表。上面的代码总是返回错误:“Microsoft.SharePoint.Client.IdcrlException:'登录名或密码与 Microsoft 帐户系统中的不匹配。'”

4

0 回答 0