locked
Want to export many MSProject's projects to XML automatically. RRS feed

  • Question

  • Hi,

    I am currently developing a way to connect certain MSProjects' data to a web application that can be easily use by users around the world to update them.

    This action is not suppose to be always available, only sometimes, and people will have a certain time to update data.

    My strategy is to give a C# application to the responsible of this massive update (which have access to .mpp files) that will export .mpp files in .xml (or other easy-to-use format), upload them to the server and call a PHP script that will parse XML files and 'activate' the update GUI.

    The next step will be the same but reverse : PHP script will build XML files, download them to responsible PC and another C# application will update the .mpp files with the XML ones.

    Unfortunately, I am stuck to the first step, because doing this :
    Microsoft.Office.Interop.MSProject.ApplicationClass msProjectInstance = new ApplicationClass();

    for (int i = 0; i != selectedItems.Count; ++i)
    {
    string url= selectedItems[i].ToString();
    msProjectInstance.FileOpen(@url, Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, PjPoolOpen.pjPoolReadOnly,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value);
    msProjectInstance.FileSaveAs(@sourceProjects + selectedItems[i].ToString().Substring(0, selectedItems[i].ToString().LastIndexOf('.')) + ".txt",
    PjFileFormat.pjTXT, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value,
    Missing.Value, Missing.Value, Missing.Value);
    }

    Is prompting the MSProject Export Wizard (which is annoying considering that the usage of MSProject must not be known by user and this must be performed on many projects). It's certainly a miss-understanding of FileSaveAs function (PjFileFormat doesn't have pjXML param and I don't know how to use the eighteenth param XMLName).

    Does anyone can give me advice on how exporting .mpp files into .xml files with C#? Thanks alot.

    Regards,

    - Renaud
    PS : We are using MSProject 2007.
    • Moved by Harry Zhu Wednesday, March 3, 2010 6:31 AM (From:Visual C# Language)
    Friday, February 26, 2010 6:25 PM

Answers

All replies