none
Change property of an item when it is drag & dropped RRS feed

  • Question

  • Hello,

    I hope someone can help me.
    I'm working in a team of several people who are all working in the same mailbox. In that mailbox each person has his own folder with his name where the ongoing mails are stored. Sometimes it happens that mails are dispatched by somebody in another folder which is not his/her folder. Therefor I'm looking for VBA code wherein is an event is fired when an email is drag and dropped in a folder. That event should change a property in that mailitem wherein I can see who moved that email.

    I found several ways to fire an event when a mail is moved to a folder, but then I can't see who moved that item, it just says there is an item moved.

    Is there a VBA code which fires an event whenever person x moves a mail to folder y and that everybody can see in 1 of the item properties that person x moved that item to folder y?

    Thanks.

    Kind regards,
    Stein

    Friday, January 16, 2015 2:29 PM

Answers

  • Hello Stein,

    You can try to use the BeforeItemMove event which is fired when an item is about to be moved or deleted from a folder, either as a result of user action or through program code. Here is what MSDN states for the event:

    This event fires when the item is about to be moved to another folder (including the Deleted Items folder) or when the item is about to be permanently deleted. It does not fire during auto-archiving or synchronizing operations.

    If the action is a permanent delete, the MoveTo folder returned in the event will be Null (Nothing in Visual Basic).

    So, when the user drags and drops the item the event is fired and in the code you can add a user property with a user name set as a value. Then in each folder you may customize the CurrentView property value and include that user property into the view. Thus, you will get the required information who moved the Outlook item.

    • Marked as answer by Stein Elsen Tuesday, January 20, 2015 1:30 PM
    Friday, January 16, 2015 2:39 PM

All replies

  • Hello Stein,

    You can try to use the BeforeItemMove event which is fired when an item is about to be moved or deleted from a folder, either as a result of user action or through program code. Here is what MSDN states for the event:

    This event fires when the item is about to be moved to another folder (including the Deleted Items folder) or when the item is about to be permanently deleted. It does not fire during auto-archiving or synchronizing operations.

    If the action is a permanent delete, the MoveTo folder returned in the event will be Null (Nothing in Visual Basic).

    So, when the user drags and drops the item the event is fired and in the code you can add a user property with a user name set as a value. Then in each folder you may customize the CurrentView property value and include that user property into the view. Thus, you will get the required information who moved the Outlook item.

    • Marked as answer by Stein Elsen Tuesday, January 20, 2015 1:30 PM
    Friday, January 16, 2015 2:39 PM
  • Thank you very much, this solved my little issue.

    I ran against a second issue. Whenever I'm working in an inspector and I click the move/copy button to move or copy the mail into a specific folder, nothing happens. I want to fire an event on the moment somebody clicks the folder wherein he/she wants to put the mail. Is there an event or something like it to make this work?

    Thanks.

    Tuesday, January 20, 2015 1:38 PM
  • You may find the BeforeFolderSwitch and FolderSwitch events helpful.
    Tuesday, January 20, 2015 1:44 PM
  • No, this is not realy what I was looking for. Because this is an event when you are working in the explorer. I want to have an event when you double click in the explorer on a mail and you don't choose for move mail to... then there should be something fired up. I can't find any suitable event for this in the outlook.inspector object.

    Can you help?

    Thanks.

    Tuesday, January 20, 2015 2:00 PM
  • NewInspector event is fired when you open a new inspector window. Also you may find the Activate event of the Inspector class helpful.
    Tuesday, January 20, 2015 3:29 PM
  • I think I know how to proceed... :)

    If i'm looking to the explorer window and I right click on a mailitem which is not selected yet, there is a contextmenu that opens. How can I fire an event when one of the options is clicked in that contextmenu?

    Little extra: I'm using Outlook 2013.

    Thanks.

    Friday, January 23, 2015 12:54 PM
  • See Temporarily Repurpose Commands on the Office Fluent Ribbon .

    I'd suggest creating new forum threads for separate questions. Thus, forum readers may recognize questions and answers/possible solutions.

    Friday, January 23, 2015 1:18 PM