Hello!
I want to drag the pdf attachment from an Outlook mail window into my app window to copy the attached pdf file to the C:\TEMP folder. I tried to do this with the help of the MBS Win plugin (WindowsDropTargetMBS).
I compiled the example “Attachment Drop from Outlook” from the MBS examples. When I drag the pdf onto the window, I get some informations. But the method .GetPaths always seems to returns nothing. With the method .GetFileContents I get the filename of my pdf file, but I am not able to copy the file to the wanted location.
Is there somebody who can help to show me what I am doing wrong?
(Using Xojo 2025 R2 on MacBook Air M3, MBS Plugins 25.3, Windows 11, Office 365)
FileDropWindow.List.RemoveAllRows
FileDropWindow.List.AddRow "Formats: " + Join(dataObject.Formats, ", ")
If allowed Then
// allow it
effect = DROPEFFECT_COPY
Var files(-1) As FolderItem = dataObject.GetPaths
For Each f As FolderItem In files
// we got a file you can use like any other file (e.g. copy)
//
// this NEVER happens! Seems that .GetPaths does not work
// the code to copy the file should be here...
FileDropWindow.List.AddRow "Path """ + f.NativePath + """"
Next
Var des(-1) As WindowsFileDescriptorMBS = dataObject.GetFileDescriptors
For Each d As WindowsFileDescriptorMBS In des
// we got file descriptions. Some metadata and the data. No path.
//
// This works...
Var data As String = dataObject.GetFileContents(d.Index)
FileDropWindow.List.AddRow "File """ + d.FileName + """ with " + data.Length.ToString + " bytes data."
FileDropWindow.List.AddRow "ClassID: " + d.ClassID
FileDropWindow.List.AddRow "Flags: " + d.Flags.ToString
FileDropWindow.List.AddRow "FileAttributes: " + d.FileAttributes.ToString
Next