Programmatically Opening a Project stored in Server using Project Professional

B

BertC

I originally posted this in pro_and_server, but was encouraged to post
it here.

I am trying to write code (in VB.NET) that will open Project
Professional 2003 and display a project stored in Project Server 2003.
Reading other posts in this group leads me to believe that the only way
to sign on to Project Server is using command line arguments. There
don't seem to be API's to connect otherwise. I've tried writing the
following code:


Dim psi As New ProcessStartInfo("C:\Program Files\Microsoft
Office\OFFICE11\Winproj.exe")
psi.Arguments = "/S http://bcushman2/projectserver"
'psi.WindowStyle = ProcessWindowStyle.Hidden
mProcess = Process.Start(psi)
Do
Application.DoEvents()
Loop While Not mProcess.Responding


mApp = New MSProject.Application
mApp.FileOpen("<>\Test3.Publis­hed")


But when I run this, the code breaks out of the loop, but the FileOpen
method throws:


An unhandled exception of type
'System.Runtime.InteropService­s.COMException' occurred in
mscorlib.dll
Additional information: Call was rejected by callee.


I could put a Thread.Sleep after starting the process, but as the times
to log into Server vary greatly, this is not a pleasant prospect. I
could also put the FileOpen in a loop that keeps catching the
exception, but this seems fairly ugly too. Anyone have elegant ways of
attempting this?
 

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