Fluent PS: Using a local PS instance to update custom fields

Nov 11, 2010 at 5:15 PM

Hello,

I am a newbie in PS 2010 development. I am building a custom workflow and want to update custom fields in PS2010 using the workflow. Your FluentPS videos for reading and updating customs have been very helpful in this regard.

I have written the same code as yours using FluentPS but instead of default instance of PS 2010, I am using another instance such http://....:15296/TestPWA/. Please can you help me in understanding how does FluentPS know which instance to access and update custom fields for that instance.

Also, I am receiving an error against the code line in Program.cs file, "var project = projectsService.Get(projectUid);".
The error is "The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'. What does this error mean? How can I fix it.

Please can you help me with this.

Thanks in advance.

 

Coordinator
Nov 12, 2010 at 8:33 AM
Edited Nov 12, 2010 at 8:39 AM

Hello aamnak,

Thank you for using FluentPS library! Find answers/recomendations below.

Q: How to tell FluentPS to communicate with non-default instance of PWA site?
A: Right after you created instance of SessionService class, you can set properties UrlSchemeHostName, Port and PWA. So to access the PWA site located by URL https://TestProjectServer:1234/TestPWA/, you'll code something like this: var sessionService = new SessionService{ UrlScheme = "https", HostName = "TestProjectServer", Port = 1234, PWA = "TestPWA" };

Q: Receiving error "The HTTP request is unauthorized with client authentication scheme 'Ntlm'."
A: There are several possible reasons of it:
1. User running this code doesn't have permissions to make PSI calls. If you run your code from workflow/ PS event receiver, make sure you've added Workflow Proxy User Account/App Pool Account to Project Server users.
2. Anonimous access is turned on. Project Server appears not to work with it, so turn it off.

PS: if you need to update Project Custom Fields from Workflow, the "native" solution is to use OOB Workflow activity named "UpdateProjectProperty" for this purpose.

aamnak wrote:

Hello,

I am a newbie in PS 2010 development. I am building a custom workflow and want to update custom fields in PS2010 using the workflow. Your FluentPS videos for reading and updating customs have been very helpful in this regard.

I have written the same code as yours using FluentPS but instead of default instance of PS 2010, I am using another instance such http://....:15296/TestPWA/. Please can you help me in understanding how does FluentPS know which instance to access and update custom fields for that instance.

Also, I am receiving an error against the code line in Program.cs file, "var project = projectsService.Get(projectUid);".
The error is "The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'. What does this error mean? How can I fix it.

Please can you help me with this.

Thanks in advance.

 

 

Nov 12, 2010 at 5:24 PM

Hi AndrewGrushewsky,

It worked fine as soon as I set the session correctly to my instance. Thanks for the great feedback. It has been very helpful.

The second error was removed automatically since my username was not added as an Admin in the default instance. When I set the session variable to my instance, the "unauthorized access error" was removed.

As for your suggestion on the "UpdateProjectProperty": My workflow is connected to a document library(Sharepoint list) instead of the PDPs so I am not sure if I can use the "UpdateProjectProperty", Can I? I tried that but it failed so I think I need to update Enterprise Custom fields via the PSI.

Another question that I would like to ask is that: If I want to set my custom Workflow Stages to the PS Workflow stages e.g. Initial Proposal Details, Automated Rejection Stage etc. can I do that through FluentPS? If yes, please can you guide me on how to do that.

P.S. I would like to appreciate FluentPS as buidling a webservice for PSI calls from scratch is diffcult. If it weren't for FluentPS, I would have been stuck with buidling the service forever.

 

AndrewGrushewsky wrote:

Hello aamnak,

Thank you for using FluentPS library! Find answers/recomendations below.

Q: How to tell FluentPS to communicate with non-default instance of PWA site?
A: Right after you created instance of SessionService class, you can set properties UrlSchemeHostName, Port and PWA. So to access the PWA site located by URL https://TestProjectServer:1234/TestPWA/, you'll code something like this: var sessionService = new SessionService{ UrlScheme = "https", HostName = "TestProjectServer", Port = 1234, PWA = "TestPWA" };

Q: Receiving error "The HTTP request is unauthorized with client authentication scheme 'Ntlm'."
A: There are several possible reasons of it:
1. User running this code doesn't have permissions to make PSI calls. If you run your code from workflow/ PS event receiver, make sure you've added Workflow Proxy User Account/App Pool Account to Project Server users.
2. Anonimous access is turned on. Project Server appears not to work with it, so turn it off.

PS: if you need to update Project Custom Fields from Workflow, the "native" solution is to use OOB Workflow activity named "UpdateProjectProperty" for this purpose.

aamnak wrote:

Hello,

I am a newbie in PS 2010 development. I am building a custom workflow and want to update custom fields in PS2010 using the workflow. Your FluentPS videos for reading and updating customs have been very helpful in this regard.

I have written the same code as yours using FluentPS but instead of default instance of PS 2010, I am using another instance such http://....:15296/TestPWA/. Please can you help me in understanding how does FluentPS know which instance to access and update custom fields for that instance.

Also, I am receiving an error against the code line in Program.cs file, "var project = projectsService.Get(projectUid);".
The error is "The HTTP request is unauthorized with client authentication scheme 'Ntlm'. The authentication header received from the server was 'NTLM'. What does this error mean? How can I fix it.

Please can you help me with this.

Thanks in advance.

 

 

 

Coordinator
Nov 15, 2010 at 1:49 PM
aamnak wrote:

As for your suggestion on the "UpdateProjectProperty": My workflow is connected to a document library(Sharepoint list) instead of the PDPs so I am not sure if I can use the "UpdateProjectProperty", Can I? I tried that but it failed so I think I need to update Enterprise Custom fields via the PSI.

Another question that I would like to ask is that: If I want to set my custom Workflow Stages to the PS Workflow stages e.g. Initial Proposal Details, Automated Rejection Stage etc. can I do that through FluentPS? If yes, please can you guide me on how to do that.


Hi aamnak,

The UpdateProjectProperty is supposed to be used only in Project Workflow, so in your case you should use PSI.

As for your another question, if you want to create Project Workflow having some set of stages, this should be done with Sequence Workflow directly, and stages' Uids should be hard-coded in workflow code-behind. But if you are talking about moving projects from stage to stage, there are methods in PSI which can help you. But currently FluentPS doesn't cover such functionality.