Can you save a file on the local drive through RemoteApp instead of saving to server drives?

风流意气都作罢 提交于 2019-12-22 18:03:11

问题


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)) {}

回答1:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!