PSI 2007 Impersonation doesn't work

B

Bernie E

I need some help. I am trying to write an application that imports timesheet
information into tasks when a user submits their timesheet. I have the
import portion working fine from a console application for the current user
(this application is run from my PC hitting the Project Server). I am now
trying to get impersonation working so that I can hook it up to an event.

I have followed all the steps in the How to Write a Simple Impersonation
application. Everything works up to the point where I set the Impersonation
context. After that, if I try to run: Guid impersonatedUserGuid =
resProxyBySSP.GetCurrentUserUid(), I get a 401 unauthorized error. I have
even tried inserting the following code:

ICredentials SSPcred = new NetworkCredential("PSAdminAccount", "AccountPW",
"");
resProxyBySSP.Credentials = SSPcred;

I also get the same 401 error if I run the ProjTool application from my PC
when I try to do Logon As.

How do I solve the 401 problem?

Thanks in advance.
Bernie
 
B

Brian Smith \(MSFT\)

Hi Bernie,

The key thing with impersonation is that your process must be running as the
same account that runs the shared services provider. I've run into the 401
error when running as myself using ProjTool and trying to get impersonation
working.

Best regards,

Brian.
 
B

Bernie E

Thanks for the response Brian.

In the code below, I am setting the credentials to the account of the Shared
Services Provider. Will that not work for testing?

ICredentials SSPcred = new NetworkCredential("PSAdminAccount", "AccountPW",
"");
resProxyBySSP.Credentials = SSPcred;

Regards,
Bernie
 
B

Brian Smith \(MSFT\)

I'm not talking about the credentials you are trying to impersonate - but
the actual running process. So for instance if using ProjTool I would need
to be logged in as the same account running the SSP for the impersonation to
work. I would try to get projtool working first and then you should be able
to understand how this applies to your code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top