How to make actions on MS Project publish event

  • Thread starter Thiago Przybylovicz
  • Start date
T

Thiago Przybylovicz

Hi, everyone.

I'm new on Project development, and I have actions in my app that need to be
made on publish event. For now, I changed the Project WebService Reference.cs
code (that came with Project SDK) and in the application it works perfectly.
But the next step is trigger that actions when the client uses the publish
event on Project Professional. For that, I'll need to change the code for the
event directly on the server's Project.asmx reference class, right?

There's another way, or better, there's A WAY to do that?

I'll wait for the answers. Thanks.
 
S

Stephen Sanderlin

You'll want to write a custom event handler for one of the publishing
events (either OnPublished or OnPublishing, depending on whether you
want a post or pre event respectively). Information on this is in the
SDK.



As an aside, avoid altering the code in Reference.cs. this is a proxy
class generated by Visual Studio and almost always should be left as-is.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com





"Thiago Przybylovicz" <Thiago (e-mail address removed)>
wrote in message
 
T

Thiago Przybylovicz

Hello, Stephen. First of all, thank you for the reply...

I made a EventHandler class like "TestEventHandler" that is in SDK, made a
strong name and installed the assembly in GAC. I changed the class in
Project.asmx for my assembly class but I had the following error:

Parser Error Message: Could not create type
'BematechEventHandler.BematechEventHandler'.

Do you know why? I made the correct thing?

P.S.: Thanks for the advice about reference.cs. Already resolved.
 
S

Stephen Sanderlin

No problem - glad to help.



You don't need to change Project.asmx. return it to its original state.
The SDK article "How to: Write and Debug a Project Server Event Handler"
contains Procedure 4, which instructs you on the proper way to deploy
your custom event handler.



PS07 provides everything you need for this. you should never, ever
change any of the files installed by PS/WSS/MOSS except in a very short
list of situations.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com





"Thiago Przybylovicz" <[email protected]>
wrote in message
 
T

Thiago Przybylovicz

Thank you, Stephen. I can see everything clearly now! =)

But my eventhandler is throwing the following exception:

The remote name could not be resolved: 'devdocpj12'
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at GerenciadorProject.ProjectWebSvc.Project.ReadProject(Guid projectUid,
DataStoreEnum dataStore)
at BematechEventHandler.BematechEventHandler.OnPublishing(PSContextInfo
contextInfo, ProjectPrePublishEventArgs e)


Just to you know what I need to do: I have to save in a database the data of
the tasks that belongs to the project that I'm publishing... I'm searching
for the data with the ProjectDataSet, but I think that my project instance is
not getting the credentials properly...
 
S

Stephen Sanderlin

No problem, Thiago. It can be confusing when you first start out - the
custom event handlers are somewhat unique.



It looks like your servername may be incorrect or not resolving
correctly. try using the FQDN instead of just "devdocpj12". At this
point, it doesn't look like a credentials problem. though we'll see what
happens. The event handler should run under the context of the SSP
Administrator, so as long as that user has Admin rights to PS, you
should be fine if you're using CredentialsCache.DefaultCredentials and
don't need to impersonate.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com





"Thiago Przybylovicz" <[email protected]>
wrote in message
Thank you, Stephen. I can see everything clearly now! =)

But my eventhandler is throwing the following exception:

The remote name could not be resolved: 'devdocpj12'
at System.Net.HttpWebRequest.GetRequestStream()
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodName, Object[] parameters)
at GerenciadorProject.ProjectWebSvc.Project.ReadProject(Guid projectUid,
DataStoreEnum dataStore)
at BematechEventHandler.BematechEventHandler.OnPublishing(PSContextInfo
contextInfo, ProjectPrePublishEventArgs e)


Just to you know what I need to do: I have to save in a database the data of
the tasks that belongs to the project that I'm publishing... I'm searching
for the data with the ProjectDataSet, but I think that my project instance is
not getting the credentials properly...


:

No problem - glad to help.



You don't need to change Project.asmx. return it to its original state.
The SDK article "How to: Write and Debug a Project Server Event Handler"
contains Procedure 4, which instructs you on the proper way to deploy
your custom event handler.



PS07 provides everything you need for this. you should never, ever
change any of the files installed by PS/WSS/MOSS except in a very short
list of situations.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com





"Thiago Przybylovicz" <[email protected]>
wrote in message
 
T

Thiago Przybylovicz

Hi, Stephen. As usual, you were right... With the FQDN it works, but now I
have this error: "The request failed with HTTP status 401: Unauthorized.".

Wierd, because I am accessing with Admin credentials, and setted the
CredentialsCache.DefaultCredentials on my code. Can be anything wrong on it?
There's a way to put the credentials manually on code?
 
S

Stephen Sanderlin

You can create a new NetworkCredentials object and assign it the desired
credentials, then assign it to the Credentials property on your instance
of the PSI's proxy class. You can also use impersonation, which is
discussed at length in the SDK and on numerous blogs.



Remember, Event Handlers run in the context of the SSP's process
account. Generally, you will receive a 401 error when using
DefaultCredentials if the SSP Admin account does not have the correct
Project Server rights. Ensure that this user is a member of the
Administrators group in Project Server.



I'm glad I've been able to help - keep em coming! :eek:)

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com





"Thiago Przybylovicz" <[email protected]>
wrote in message
 
T

Thiago Przybylovicz

Man, you're a genius!!!

It worked perfectly, thank you so much!

Best regards!
 

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