简体   繁体   English

从Project Server 2013工作流消费ProjectData-禁止

[英]Consume ProjectData from Project Server 2013 Workflow - Forbidden

I need to consume data from http://project/pwa/_api/ProjectData Project OData service from Project Server 2013 Workflow. 我需要使用来自Project Server 2013工作流的http://project/pwa/_api/ProjectData Project OData服务中的数据。 But I got "Forbidden" Response Code. 但是我得到了“禁止”响应代码。 User have all rights (Administrator, Site Collection Administrator). 用户具有所有权限(管理员,网站集管理员)。 Consuming other endpoints (ProjectServer, Web, Lists) successfull, even from other site collections and farms. 即使从其他网站集和服务器场中,也成功使用其他端点(ProjectServer,Web,列表)。 When I need configure a security to successfully consume ProjectData? 什么时候需要配置安全性以成功使用ProjectData? Thank you! 谢谢!

Have you tried to provide credentials 您是否尝试提供凭证

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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM