Connecting Project Professional to Project Server

A

Alan Bruce

I'm trying to use Visual Basic to automate Project Professional and connect
it to Project Server, but I can only ever get it to use an offline profile.
I can't find any methods which allow Project to go online, although I can
set all the collaboration options to point to the Project Server etc.

Any help would be greatly appreciated!

Thanks everyone,
Alan
 
T

Tim Dutton

Hi Alan,

To do this you have to ensure that you provide the correct switches to the
WinProj.exe to enable it to initially connect

If you try this from the run prompt WinProj.exe /S http://serveraddress /U
username /P password it will open in the correct way.

I have recently done this using C# through the windows scripting shell (a
similar approach should be used for VB) as it gives access to the running
processes and you can implement call backs to determine memory leaks.

See an example below:

MSProject.Application oProj;

//Create the shell commmand
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = "winproj.exe";
proc.StartInfo.Arguments = @"/S http://servername /U Administrator /P
password";
proc.StartInfo.UseShellExecute = true;
proc.StartInfo.CreateNoWindow = false;
proc.Start();

//Sleep while Project is opening to avoid COM Error
Thread.Sleep(4000);

//Cast the current instance to an object to ensure multiple are not
created
oProj = (MSProject.Application)
System.Runtime.InteropServices.Marshal.GetActiveObject("MSProject.Applicatio
n");
oProj.AutomationSecurity =
Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityLow;
//Switch off the dialog alerts for the application
oProj.DisplayAlerts = false;

Hope it helps

T
 

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