none
How to call PSI with elevating privileges RRS feed

  • Question

  • Hello all.

    In my case I try make some sharepoint web service, which call PSI and returns count of resources (ReadResources method).

    I.e. usually user not see all resource pool, web service return only part of data corresponding to current user permissions.

    How I can elevate privileges and return full data (count of all resources in pool) without hard-coding administrative accout credentials with password? Maybe there's a way to use Secure Store or another service?

    Friday, November 2, 2012 9:24 AM

Answers

  • Hello all. No one answer not help me. I resolved this problem with RunWithElevatedPrivileges.

    Thanks all.

    • Marked as answer by MrNight Monday, November 12, 2012 7:53 AM
    Monday, November 12, 2012 7:53 AM

All replies

  • no one knows?
    Tuesday, November 6, 2012 10:59 AM
  • Dont worry MrNight, its very simple.

    Just use impersonation using Project Server PSI, and impersonate current user with your desired user(admin,resource manager, project manager etc).

    Detail and sample code on impersonation is mentioned in following article Using Impersonation In Project Server.

    Thanks and let me know in case have any further questions.


    Sachin Vashishth MCTS

    Tuesday, November 6, 2012 11:20 AM
  • Hello Sachin! Thanks for your answer.

    I also tried to use impersonation, but it does not work within web-service (401 error: not authorized). Do I understand correctly it is necessary that current login must have administrative privilegies to impersonate?

    Or I should create separate web-application (with administrative account) for that?

    P.S. I have Project server 2010 installation.

    Wednesday, November 7, 2012 12:43 PM
  •   Hello Mr. Night, whatever account your code is running under to access the PSI must be authorized as well/have permissions. So not necessarily your current login but yes permissions are needed. Also if you want it to be able to access all projects, very likely as any user could run it(?), it may need admin group or at least the my org category.


    Ray Letts Arbutus Solutions

    Wednesday, November 7, 2012 3:57 PM
  • That's a problem. In this example I need to every user can read count off all resources. As a number.

    Actually, I need to fill a field in Infopath form with "vertical chain" of users based on RBS of current user. For this I try develop web service to get data from PSI and calculate this chain (as a text,for example). For that task web service should have permissions to read data for ALL resources. But infopath form run under current user credentials. And I dont want hard-code administrative account in the form. Impersonalisation also don't help.


    Any more suggestions?

    Thursday, November 8, 2012 9:40 AM
  • no one knows?
    Friday, November 9, 2012 11:47 AM
  • If you are running a webservice, this webservice is running under the account of the application pool. That account needs to have permissions within Project Server. When rich enough, that account can 'impersonate' the PSI, which is done by adding some headers in the PSI webservice request. There are plenty of examples in the SDK that illustrate how to do this. For some PSI calls it is essential to run in the context of the user. Basically this means, that your web service needs to retrieve the account that requested the web service, look up that account using the PSI against the resource service, use the GUID returned from there as impersonation information and proceed with your desired PSI web service call.

    Jan Cirpka

    Friday, November 9, 2012 12:28 PM
  • Hello all. No one answer not help me. I resolved this problem with RunWithElevatedPrivileges.

    Thanks all.

    • Marked as answer by MrNight Monday, November 12, 2012 7:53 AM
    Monday, November 12, 2012 7:53 AM