1. Christopher Craft
  2. PowerBuilder
  3. Friday, 3 May 2024 20:00 PM UTC

PB 2022

Does anyone know how I can determine if a user selected an attachment within an email to drag/drop using OLE?  

When I get notified of the drop I loop through all the selected email items using .ActiveExplorer.Selection.Count.  Once I have that I was hoping I could loop through lole_item.Attachments and do the same but that does not seem to have a ‘selected’ property. Is there a trick to get this?

Thanks again,

Chris Craft

Who is viewing this page
Christopher Craft Accepted Answer Pending Moderation
  1. Tuesday, 30 July 2024 17:14 PM UTC
  2. PowerBuilder
  3. # 1

Well, I think I am about to give up on this.  The following code only works if the user has clicked the attachment in the Email before dragging it over (it is visible in the Email). ActiveExplorer.AttachmentSelection.Count returns zero if you start dragging the attachment before clicking it first.  The other issue is once the attachment has been selected then the count will always be greater than zero regardless of it being visible in the Email or not. This means they cannot go back and start dragging the Email until then have clicked off of it and then back on to clear the count.

ll_selected_outlook_count = lole_OutlookApp.ActiveExplorer.AttachmentSelection.Count
IF ll_selected_outlook_count > 0 THEN
   FOR llNdx = 1 to ll_selected_outlook_count
      ls = lole_OutlookApp.ActiveExplorer.AttachmentSelection.item(llNdx).FileName
   NEXT
END IF

I have read many posts about this issue with other developers.  The one solution that someone provided was to use the FileGroupDescriptor from the IDataObject ( Outlook Drag and Drop in C# - CodeProject ) but I have been unsuccessful in getting that to work in PowerBuilder.

I think I am all fished out for now.  If anyone finds out how to do this please let me know!

Chris Craft

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 3 May 2024 22:02 PM UTC
  2. PowerBuilder
  3. # 2

Well, Chris, assuming your question is in regards to Outlook, in this "teach a person to fish" moment... what I do when faced with a question about manipulating information in Outlook or other Office products is look at the online documentation for the product's Object Model, which for Outlook can be found here:

    https://learn.microsoft.com/en-us/office/vba/api/overview/outlook/object-model

The objects in Outlook are listed alphabetically in the sidebar, and right after "Attachment", then "Attachments" (which is a collection of all of the Attachment objects in an Outlook item) is...(drum roll, please...) "AttachmentSelection":

    https://learn.microsoft.com/en-us/office/vba/api/outlook.attachmentselection

This object is a collection of the currently-selected attachments in an Outlook item (i.e., message).

Best regards, John

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 3 May 2024 20:09 PM UTC
  2. PowerBuilder
  3. # 3

Are you referring to manipulating Outlook via OLE?

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.