简体   繁体   中英

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. 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. When I need configure a security to successfully consume 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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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