How to programatically open an enterprise project?

S

Shivesh

Using the javascript available in the "view source" of MSPS 2003 PWA, we
figured out a way to programatically open the enterprise project schedule
from our application.

Looks like Project 2007 PWA does postback and we are not able to do the same
anymore. Our uses are very mush used to forget their project name and just
use the link at our custom application to open the project.

Is there anyway can we open the enterprise project programatically from a
..net code or from some javascript? We will be knowing the Project GUID or ID
when we try to open this.
 
S

Shivesh

We are trying to open an enterprise project in project professional (MS
Office Project 2007 Client). My application is launching the project client
but at the same also the project schedule from MSPS within MS Project client.

Hope this makes sense. Any help would be greatly appreciated.
 
R

Rod Gill

Hi,

The trick is to open Project Pro connected to Project Server. If I needed to
do this from Excel VBA I would use:

Sub StartProjectPro()
'Requires Reference to Microsoft Project
Dim projApp As MSProject.Application
On Error Resume Next
'Uses Windows Authentication as no username or password parameters added
Shell "winproj.exe /s http://ProjectServerName/ProjectServer/"
Do Until Not (projApp Is Nothing)
DoEvents
Set projApp = GetObject(, "MSProject.Application")
Loop
Debug.Print projApp.Name
Debug.Print projApp.Profiles. _
ActiveProfile.ConnectionState
projApp.Quit
Set projApp = Nothing
End Sub

I'll leave it to you to convert to Javascript!

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com
 
S

Shivesh

Thanks. Looks like we are pretty close. How to open a specific project if I
know the name of the project or the Web proj ID or the GUID along with the
client?

In my earlier implementation, we were able to open a specific project in the
project client showing as a hyperlink on my application.
 
R

Rod Gill

Try recording a macro in Project Pro of you doing this. It will give you the
code needed.

--

Rod Gill
Microsoft MVP for Project

Author of the only book on Project VBA, see:
http://www.projectvbabook.com



Shivesh said:
Thanks. Looks like we are pretty close. How to open a specific project if
I
know the name of the project or the Web proj ID or the GUID along with the
client?

In my earlier implementation, we were able to open a specific project in
the
project client showing as a hyperlink on my application.
 
S

Shivesh

This requires me to be already logged into the project server from project
client. I want to launch the project client and at the same time load my
desired schedule.

Trust me, I am not trying to "gold plate" this. Our users are so used to
clicking this link, I really feel very bad taking away this functionality
after moving to the Project 2007
 
T

tfz

Shivesh,

I'm not sure if you are still looking for an answer, but after the MS
Project application is opened and connected to the project server, here's how
I open a project off the server from .net:

(you'll need to add a reference to Microsoft.Office.Interop.MSProject)

PSInterop.Application app = new PSInterop.Application();
app.FileOpen("<>\\" + <<project name>>, false, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, PSInterop.PjPoolOpen.pjDoNotOpenPool,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

The trick is to use the "<>\\" before the project name.
Here's some info on the application.fileopen command:
http://msdn.microsoft.com/en-us/library/bb213548.aspx

Good luck!
 
S

Shivesh

Yes. I am still looking for an answer. Even your solution assumes that MS
Project client is loaded. What if I have to do both (loading the project
client and the project with the same action) at the same time?
 
S

Stephen Sanderlin

The functionality you are looking to duplicate is within an ActiveX web
part.



Disclaimer: Spawning new processes on client machines using JavaScript
is very insecure and may not be possible depending on your local
security configuration. It would be more secure to train your users to
remember their project names.



At any rate, see
http://weblogs.asp.net/farazshahkha...-to-open-application-on-client-s-machine.aspx...
this may help.


--

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
 
S

Shivesh

Yes. This worked. I will share this with my developers. Just tried from
Start->Run and it works like charm. Thanks Stephen.
 
B

Bala

Shivesh

I am also looking for the same function but using .Net to launch Project
Professional 2007 by passing the Project ID to open a specific project plan,
we have the similar function in our EPM 2003 using Java Script/classic asp.
Please let me know if I can use the same code you are using, if so, please
share.

Thanks
Balaji
 
Q

Quized again

Hello Rod. MOPS2007 system. First explanation then questions.
I have tried to use this code and I can't. I checked the Tools>References in
my Excel (which is 2003) and the MSProject 12.0 object library is not listed.
I tried to add it so I browsed to c:\windows\assembly and selected
"Microsoft.Office.Interop.MSProject" version 12.0 and nothing happens when I
try to add it. THe browse window just resets itself to the first files in
that assembly directory. If I rt-click I have the option to uninstall it.

Ok, so we rewrote the code to this and it is trying to launch MOPS2003, not
2007.

Sub Test2()
'Requires Reference to Microsoft Project
Dim projApp As MSProject.Application
'
On Error Resume Next
'Uses Windows Authentication as no username or password parameters added

Shell "winproj.exe /s http://my_servername_here/instance_name_here"
Do Until Not (projApp Is Nothing)
DoEvents
Set projApp = GetObject(, "MSProject.Application")
Loop
Debug.Print projApp.Name
Debug.Print projApp.Profiles.ActiveProfile.ConnectionState
projApp.Quit
Set projApp = Nothing
End Sub

Questions are, (could not find the answers in THE book).
1. How do I get MSP 12.0 object library to show in the Excel 2003 references?
2. Is there some code snip to add so that MSP2007 Pro launches instead of
2003?

You're help is always appreciated.
Thank you.
 

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