MS Project Server 2016指定的服务器可能不支持此操作中使用的API

时间:2019-01-25 12:42:51

标签: c# csom ms-project-server-2016

Microsoft.SharePoint.Client.ServerException:'找不到ID为“ {154360b4-899f-4237-b0ed-3e35f014c748}”的类型的存根。指定的服务器可能不支持此操作中使用的API。'

projContext.ExecuteQuery()崩溃,如何解决此问题?

    private const string pwaPath = "project site";
    private static string projName = "project name";

    private static ProjectContext projContext;
    private static PublishedTask projTasks;
    protected void Page_Load(object sender, EventArgs e)
    {
        SPSecurity.RunWithElevatedPrivileges(delegate ()
        {

            projContext = new ProjectContext(pwaPath);
            //projContext.Load(projContext.Projects);
            projContext.ExecuteQuery();

            List<string> TasksID = new List<string>();

            foreach (PublishedProject pubProj in projContext.Projects)
            {
                Console.WriteLine("\n\t{0} : {1}", pubProj.Name, pubProj.CreatedDate.ToString());
                foreach (PublishedTask item in pubProj.Tasks)
                {
                    TasksID.Add(projTasks.Name);
                }
                Console.WriteLine("\nProject ID : Project name : Created date");
            }

            Console.Write("\nPress any key to exit: ");
            Console.ReadKey(false);
        });

    }

0 个答案:

没有答案