S
Stephan Steiner
Hi
I had to write a C# application to automate project professional 2003.
Here's how I start the client:
proc = Process.Start(applicationPath, ApplicationArguments);
Where applicationpath is "C:\Program Files\Microsoft
Office\OFFICE11\WINPROJ.EXE"
and ApplicationArguments is /s http://projectserver/ProjectServer /u login
/p password
After a predefined timeout, I then initialize PIA:
application = new MSProject.Application();
application.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;
application.Calculation =
Microsoft.Office.Interop.MSProject.PjCalculation.pjAutomatic;
application.MacroVirusProtection = false;
application.DisplayAlerts = false;
application.DisplayWizardErrors = false;
I've tested the code on two test projects in the productive environment and
it worked out fine. I even ran the code on the machine it is intended to
run - though using another account on the project server.
I have the whole PIA code wrapped in a try / catch. Now when we went
productive, I started catchig errors in PIA initialization:
unable to initialize PIA of application class: Call was rejected by callee.
(Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
Upon further investigation, it turned out that when the project client was
started, it came up with two error message boxes with the following content:
Project cannot open the file.
Check that the file name and path are correct.
Check that the file format is recognized by Project.
Project files saved in an version earlier than Microsoft Project 98 can't be
opened.
If your file is from an earlier version, open it in that version, click Save
as (File menu), and save in MPX Format. Open the MPX file in the current
version of Project. When you use this method, project data is imported, but
formatting is lost.
That popup comes up once, wants you to click OK, then the same popup comes
up again.
When you manually click away these two popups, the code then runs fine (up
until the next time you have to start the project client) so I figure the
whole PIA errors are due to project not being fully initialized yet.
So I figured I could probably retrace the problem by just starting the
project client manually from the commandline, using the same arguments in my
code. However, if I do that, the error does not come up. Note that I'm doing
this under the same user account as the user account under which my software
runs. And now I'm at a loss.. why do I get these two warning messages only
when I launch the project client from my code, and how can I avoid them
(other then sending keystrokes and unreliable hacks like that) so that the
whole process can run without any manual intervention.
Regards
Stephan
I had to write a C# application to automate project professional 2003.
Here's how I start the client:
proc = Process.Start(applicationPath, ApplicationArguments);
Where applicationpath is "C:\Program Files\Microsoft
Office\OFFICE11\WINPROJ.EXE"
and ApplicationArguments is /s http://projectserver/ProjectServer /u login
/p password
After a predefined timeout, I then initialize PIA:
application = new MSProject.Application();
application.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;
application.Calculation =
Microsoft.Office.Interop.MSProject.PjCalculation.pjAutomatic;
application.MacroVirusProtection = false;
application.DisplayAlerts = false;
application.DisplayWizardErrors = false;
I've tested the code on two test projects in the productive environment and
it worked out fine. I even ran the code on the machine it is intended to
run - though using another account on the project server.
I have the whole PIA code wrapped in a try / catch. Now when we went
productive, I started catchig errors in PIA initialization:
unable to initialize PIA of application class: Call was rejected by callee.
(Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))
Upon further investigation, it turned out that when the project client was
started, it came up with two error message boxes with the following content:
Project cannot open the file.
Check that the file name and path are correct.
Check that the file format is recognized by Project.
Project files saved in an version earlier than Microsoft Project 98 can't be
opened.
If your file is from an earlier version, open it in that version, click Save
as (File menu), and save in MPX Format. Open the MPX file in the current
version of Project. When you use this method, project data is imported, but
formatting is lost.
That popup comes up once, wants you to click OK, then the same popup comes
up again.
When you manually click away these two popups, the code then runs fine (up
until the next time you have to start the project client) so I figure the
whole PIA errors are due to project not being fully initialized yet.
So I figured I could probably retrace the problem by just starting the
project client manually from the commandline, using the same arguments in my
code. However, if I do that, the error does not come up. Note that I'm doing
this under the same user account as the user account under which my software
runs. And now I'm at a loss.. why do I get these two warning messages only
when I launch the project client from my code, and how can I avoid them
(other then sending keystrokes and unreliable hacks like that) so that the
whole process can run without any manual intervention.
Regards
Stephan