GermanSniper
GermanSniper

Reputation: 269

Project Server 2013 Webpart with CSOM

I want create a webpart to display information from Project Server 2013. So that I can implement my webpart on a new page on Project Server.

My approache is to create a SharePoint 2013 Webpart and use Microsoft.ProjectServer.Client.dll

private void GetProjectsListData()
    {
        context = new ClientContext(pwaPath);
        projSvr = new ProjectServer(context);

        context.Load(projSvr.Projects);
        context.ExecuteQuery();

        gdvProjectsList.DataSource = projSvr.Projects;
        gdvProjectsList.DataBind();
    }

But I get an 401 Authentication error. I think the SP use the IIS application pool user and not my user. If I use the CSOM in a console application it is working.

Is this the correct approach to do this or should I use the PSI? Or how can i impersionate to tell the CSOM to use another user?

Upvotes: 0

Views: 363

Answers (1)

STORM
STORM

Reputation: 4331

It is not possible due to the fact what you already found, that the SP ClientContext works under the IIS App Pool account. For a OnPremise farm solution there is no way to get the CSOM working with the current user, expect you can provide username and password (but i think this is no solution).

I would prefer to use PSI or JSOM. Both are working for me. Also REST and the OData Reporting Feeds are working fine but the OData feeds are returning ALL data.

Upvotes: 0

Related Questions