【问题标题】:Consume ProjectData from Project Server 2013 Workflow - Forbidden从 Project Server 2013 工作流中使用 ProjectData - 禁止
【发布时间】:2014-07-08 06:59:06
【问题描述】:
我需要使用来自 Project Server 2013 工作流的 http://project/pwa/_api/ProjectData Project OData 服务的数据。
但我得到了“禁止”响应代码。
用户拥有所有权限(管理员、网站集管理员)。
成功使用其他端点(ProjectServer、Web、列表),甚至来自其他网站集和场。
何时需要配置安全性以成功使用 ProjectData?
谢谢!
【问题讨论】:
标签:
workflow-foundation-4
project-server
ms-project-server-2013
【解决方案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);
}