B
BertC
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.Published")
But when I run this, the code breaks out of the loop, but the FileOpen
method throws:
An unhandled exception of type
'System.Runtime.InteropServices.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?
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.Published")
But when I run this, the code breaks out of the loop, but the FileOpen
method throws:
An unhandled exception of type
'System.Runtime.InteropServices.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?