繁体   English   中英

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

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

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

您是否尝试提供凭证

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