I have an application written in C# WPF, and saving a generated Word document. Through the RemoteApp settings, I've set to show the local user's logical drives, but they don't have letters next to them. They show up as C on myHostname
, D on myHostname
, etc.
When I open up a SaveFileDialog
object, it shows Local Disk (C:)
, C on myHostname
, and D on myHostname
in the left-hand pane.
How do I set the filename, if there's no corresponding letter?
string filename = @"C:\myDirectory\myFile.docx";
using(WordprocessingDocument myDoc =
WordprocessingDocument.Create(filename,
WordprocessingDocumentType.Document)) {}
I found that if I'm using Terminal Services Client, I can use the keyword tsclient
to tell it to use the local user's drives.
// Check if remote session, and get the local drive location
if(System.Windows.Forms.SystemInformation.TerminalServerSession) {
filename = @"\\tsclient\C\myDirectory\myFile.docx";
}
来源:https://stackoverflow.com/questions/16570989/can-you-save-a-file-on-the-local-drive-through-remoteapp-instead-of-saving-to-se