Why Clipboard.GetFileDropList() returns an empty collection on Remote Desktop?

Viewed 1484

I have a program on which I need to be able to copy and paste from a remote computer, to my local computer.

My problem is, when I use

Clipboard.GetDropList();

it returns a collection with 0 elements, no matter how many elements I tried to copy.

I tried it with :

if (Clipboard.ContainsFileDropList())
{
    foreach (string item in Clipboard.GetFileDropList())
    {
        File.Copy(item, path + '\\' + Path.GetFileName(item));
    }
}

I also tried (BoltBait's answer):

System.Collections.Specialized.StringCollection idat = null;
Exception threadEx = null;
Thread staThread = new Thread(
    delegate ()
    {
        try
        {
            idat = Clipboard.GetFileDropList();
        }
        catch (Exception ex)
        {
            threadEx = ex;
        }
    });
staThread.SetApartmentState(ApartmentState.STA);
staThread.Start();
staThread.Join();

Both versions return an empty collection.

Where could the problem come from? Knowing that:

  • Copy/Pasting from Remote to local (via windows) works
  • Copy/Pasting from Local to Local (via code) works
  • Clipboard sharing is activated
  • OS (Local) : Windows 10
  • OS (Remote) : Windows Server 2008 R2
1 Answers
Related