Open a project in .xml file readable for MSProject 2007 from C#

K

Key

Hi:) Here is my problem:
I have a project that was exported in .xml file from MS Project 2007. I have
a web form that contains a text field with a full path to this .xml file and
a button. When I click the button I want the MS Project 2007 to open on the
client machine a show me the project from this .xml file.:)
I have this code, but It doesn't work unfortunately:
context.Response.ContentType = "application/vnd.ms-project";
System.IO.FileStream fs = new System.IO.FileStream (
context.Request.QueryString["filename"], System.IO.FileMode.Open,
System.IO.FileAccess.Read );
System.IO.StreamReader reader = new System.IO.StreamReader ( fs );
string data = reader.ReadToEnd ();
byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes ( data );
reader.Close ();
fs.Close ();
context.Response.Write ( result.ToString());

I'm digging this problems about 2 or 3 days and found one incomplete solution:
ApplicationClass PjApp = new ApplicationClass ();
//I don't know the right syntax to call this method, no information in help:(
bool result = PjApp.FileSaveAs ( context.Request.QueryString["filename"],
PjFileFormat.pjMPP, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null );
1. How can I open the project from the .xml file on the client machine using
web forms C#?
2. What is the correct syntax of methods Application.FileOpen and
Application.FileSaveAs?

thanks for the help:)
 
K

Key

Now I'm getting a ne error "0x80010001 Call Was Rejected by Callee"
when I'm trying to execute following lins of code:

ApplicationClass PjApp = new ApplicationClass ();
PjApp.Visible = false; //here I get error described above

I found a KB article in microsoft knowledge base
http://support.microsoft.com/kb/329854
I did every exactly step, but I didn't help:(

somebody please help me to relve this issue:)
 
K

Key

I solved all problems:) But now I need to find another one solution:) This
solution shouldn't include COM objects.
Please help:)

Key said:
Now I'm getting a ne error "0x80010001 Call Was Rejected by Callee"
when I'm trying to execute following lins of code:

ApplicationClass PjApp = new ApplicationClass ();
PjApp.Visible = false; //here I get error described above

I found a KB article in microsoft knowledge base
http://support.microsoft.com/kb/329854
I did every exactly step, but I didn't help:(

somebody please help me to relve this issue:)

Key said:
Hi:) Here is my problem:
I have a project that was exported in .xml file from MS Project 2007. I have
a web form that contains a text field with a full path to this .xml file and
a button. When I click the button I want the MS Project 2007 to open on the
client machine a show me the project from this .xml file.:)
I have this code, but It doesn't work unfortunately:
context.Response.ContentType = "application/vnd.ms-project";
System.IO.FileStream fs = new System.IO.FileStream (
context.Request.QueryString["filename"], System.IO.FileMode.Open,
System.IO.FileAccess.Read );
System.IO.StreamReader reader = new System.IO.StreamReader ( fs );
string data = reader.ReadToEnd ();
byte[] dataBuffer = System.Text.Encoding.UTF8.GetBytes ( data );
reader.Close ();
fs.Close ();
context.Response.Write ( result.ToString());

I'm digging this problems about 2 or 3 days and found one incomplete solution:
ApplicationClass PjApp = new ApplicationClass ();
//I don't know the right syntax to call this method, no information in help:(
bool result = PjApp.FileSaveAs ( context.Request.QueryString["filename"],
PjFileFormat.pjMPP, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null );
1. How can I open the project from the .xml file on the client machine using
web forms C#?
2. What is the correct syntax of methods Application.FileOpen and
Application.FileSaveAs?

thanks for the help:)
 

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