1

我需要http://project/pwa/_api/ProjectData从 Project Server 2013 工作流中使用来自 Project OData 服务的数据。但我得到了“禁止”响应代码。用户拥有所有权限(管理员、网站集管理员)。成功使用其他端点(ProjectServer、Web、列表),甚至来自其他网站集和场。何时需要配置安全性以成功使用 ProjectData?谢谢!

4

1 回答 1

1

您是否尝试过提供凭据

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security;
using System.Text;
using Microsoft.SharePoint.Client;
using Microsoft.ProjectServer.Client;

static void Main(string[] args)
{
    const string pwaPath = "http://ServerName/pwa/";
    const string password = "pwa_password";
    const string userName = "user_name@your_company.onmicrosoft.com";

    var projContext = new ProjectContext(pwaPath); 
    var secureString = new SecureString();

    password.ToCharArray().ToList().ForEach(x => secureString.AppendChar(x));

    projContext.Credentials = new SharePointOnlineCredentials(userName, secureString);

    // Get the list of published projects in Project Web App.
    projContext.Load(projContext.Projects);
    projContext.ExecuteQuery();

    Console.WriteLine("\nThere are {0} projects", projContext.Projects);
}
于 2015-04-14T20:57:03.463 回答