C# console app help needed

Soldato
Joined
1 Feb 2006
Posts
8,188
I'm putting together a console app to pull back a list of folders from a SharePoint document library. The part I cannot understand is how can I write the results to a temporary file and then have that file open up and display results to the user. Ideally it will stay open until the user closes it. They are meant to copy all the contents of the file onto the clipboard.

I am using Path.GetTempPath to create a temp file but how can I get this file to actually open in something like notepad?

Edit: ignore. I found System.Diagnostics.Process.Start which seems to do the trick.
 
Last edited:
Potential gotcha, if the OS doesn't know how to open the file you supply to that method it will throw an exception.

But you already have a try catch block round that right ;)
 
If there isn't an application associated with that file then it will bring up the 'open with' wizard. Yes there is 'limited but adequate' error handling for now.
 
Back
Top Bottom