Generate XML document from a Project 2007 file programmatically?

E

ennetws

Hi,

I was wondering if anyone knows how to convert the active Project 2007 file
into a XML document. I have seen the example in the MSDN documentation using
VB:

'Create an XML DOM document
Set doc = CreateObject "MSXML2.DOMDocument")

'Save the project to the DOM document
app.FileSaveAs FormatID:="MSProject.XMLDOM", XMLName:=doc

What I am looking for is a way to create an XML document directly, similar
to the example above, except that it should be in C#. Is their a way to do
that?

I am working on an add-in and I've reached a point where I can either save
the project as an XML file then read it or go through the tasks and create an
XML document.

Thanks.
 
J

Jack Dahlgren

I'm not a c# developer, but I see no reason why you could not call the same
methods using C# though I'm not able to give you the exact code.

-Jack
 
E

ennetws

I did try it for saving a normal .XML file. What did not work is trying to
save it to a XML document. The creation process is very different in C#. I
tried to replicate the code in C# but I keep getting errors that the supplied
values are wrong.

-Ib
 
J

Jack Dahlgren

I believe that C# requires you to supply all parameters, even optional ones.
Take a look at the method in VBA and check to make sure you know all the
parameters and supply them.

-Jack
 
B

Bryant Likes

Jack Dahlgren said:
I believe that C# requires you to supply all parameters, even optional
ones.
Take a look at the method in VBA and check to make sure you know all the
parameters and supply them.

Jack is correct, you need to supply all the parameters:

expression.FileSaveAs(Name, Format, Backup, ReadOnly, TaskInformation,
Filtered, Table, UserID, DatabasePassWord, FormatID, Map, Password,
WriteResPassword, ClearBaseline, ClearActuals, ClearResourceRates,
ClearFixedCosts, XMLName, ClearConfirmed)

Here is the url for the method info:
http://msdn.microsoft.com/en-us/library/bb213559.aspx
 

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