Supress dialog at FileOpen Interop

D

Darley

I've written a program to save all my projects from Project Server to a xml
document at a batch program. It works just fine.

But now, I'm getting some dialogs during the FileOpen method, as the view
mode replacement suggestion.
The Project stops at this dialog and waits for the user action. When the
user confirm/close this dialog, the Project gets back to run

Is there a way to supress all dialogs during the Interop calls?

I'm using vs2008, in a machine with MSProject 2003 connecting to a Project
Server 2003

Follows below an idea of my program:

// Connecting
Process.Start(Config.PathToProjectApp, "/s " + Config.ProjectWebServer);
activeObject = Marshal.GetActiveObject(Config.ApplicationName);
projectApp = (Application)activeObject;

//Opening
projectApp.FileOpen(projectName, true, PjMergeType.pjDoNotMerge,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, "MSProject.mpd", Type.Missing, PjPoolOpen.pjPoolReadOnly,
Type.Missing, Type.Missing, Type.Missing, Type.Missing);

//Saving
//projectApp.FileSaveAs(xmlFullPath, PjFileFormat.pjMPP, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, "MSProject.XML", Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing);

//Closing
projectApp.FileCloseAll(PjSaveType.pjDoNotSave);
projectApp.Quit(PjSaveType.pjDoNotSave);

Thanks,
 
J

Jack Dahlgren

If you get it during file open try Application.DisplayAlerts = False.
If you are getting it during file close try ActiveProject.Saved = True


-Jack Dahlgren
 
D

Darley

I'm getting this dialog at FileOpen method.

I've already tried to set some of these Display* properties to false.

But no one works, and some of them causes a COM exception

This one specific (DisplayAlerts = false) changes his value to false, but
the dialog still displayed.

Thanks.
Darley
 
J

Jack Dahlgren

What alert specifically is shown?

There are some other things you might try, but I need to know what sort of
message is being displayed in order to make further suggestions.

-Jack Dahlgren
 
D

Darley

After someone changed the global enterprise model, the Project ask to update
your copy of this model.

Message:
The global enterprise model already have a view mode called "view-mode-name"
Would you like to replace the view mode by the global enterprise model,
replace all name duplicated itens, rename the project view mode or don't open
the project?

Options:
Replace, Replace all, Rename and Cancel
 
J

Jack Dahlgren MVP

I'd resolve that problem in the files / Global. That should eliminate the
message.
Do you want that view in the local or enterprise global?

-Jack Dahlgren
 
D

Darley

Enterprise global.

I'm thinking about eliminate all my locals views before the FileOpen.
But I don't know how do that.

Darley
 

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

Similar Threads


Top