none
I want to ask event about drop files on MAPIFolder RRS feed

  • Question

  • Hi team,

    I need a event that be fired only once, when drag&drop mail items or attachment files onto MAPIFolder in outlook 2010.I have uploaded a  picture, please refer to the scenario link below .This is import for me, any hints or solutions will be appreciated.

    Scenario




    • Edited by 董建华 Saturday, March 15, 2014 9:37 AM
    Saturday, March 15, 2014 9:18 AM

Answers

  • I can propose two workarounds for getting the job done:

    1. You can check the Selection property of the Explorer class and count the ItemAdd events according to the number of selected items. In the last ItemAdd event handler you can display your form.

    2. In the first ItemAdd event handler you can show a form asynchronously. Then, if the ItemAdd is fired again you can update the data on your form.

    Note, the ItemAdd event is fired when you move items programmatically too (or using an Outlook rule). So, the latter solution is preferred.

    • Marked as answer by 董建华 Saturday, March 15, 2014 11:15 AM
    Saturday, March 15, 2014 10:12 AM
  • Hi team,

    The ItemAdd event is fired after all items has been dropped on folder.
    We use the object parameter's parent to get all drag&drop items.
    Hope this info will help the others.

    MAPIFolder parentFolder = null;
    if (obj is DocumentItem)
    {
        parentFolder = (obj as DocumentItem).Parent as MAPIFolder;
    }
     if (obj is MailItem)
    {
       parentFolder = (obj as MailItem).Parent as MAPIFolder;
    }

    Thanks.


    • Marked as answer by 董建华 Tuesday, March 18, 2014 10:07 AM
    • Edited by 董建华 Tuesday, March 18, 2014 10:08 AM change
    Tuesday, March 18, 2014 10:07 AM

All replies

  • Hello,

    As I already write to you in another forum thread, the Outlook object model doesn't provide such events (nor Extended MAPI). The ItemAdd event is fired for each item separately.

    Saturday, March 15, 2014 9:38 AM
  • Hi Eugene,

    Thanks for your so much help, but i need to develop an outlook addin. When drop files on mapifolder, we pop up a new form.However, i won't let the form pop up for each item separately.Now i know how to get the files, but i need an event that be fired only once to pop up the new form, then we put all selection files to the form.




    • Edited by 董建华 Saturday, March 15, 2014 9:51 AM
    Saturday, March 15, 2014 9:46 AM
  • I can propose two workarounds for getting the job done:

    1. You can check the Selection property of the Explorer class and count the ItemAdd events according to the number of selected items. In the last ItemAdd event handler you can display your form.

    2. In the first ItemAdd event handler you can show a form asynchronously. Then, if the ItemAdd is fired again you can update the data on your form.

    Note, the ItemAdd event is fired when you move items programmatically too (or using an Outlook rule). So, the latter solution is preferred.

    • Marked as answer by 董建华 Saturday, March 15, 2014 11:15 AM
    Saturday, March 15, 2014 10:12 AM
  • Hi Eugene,

    I think the first workarounds is the best for the job done, i will try this tomorrow.

    The second workarounds is also a good idea,  which will be taken into consideration.

    Also thanks for your friendly note, and we will take notice that.

    As we have hidden the default button in ContextMenuFolder, and we only use the folder to view url.Hope everything goes well!

    The world is beautiful because of you!

    Thanks a lot for your reply, best regards!

    Saturday, March 15, 2014 11:15 AM
  • Hi team,

    The ItemAdd event is fired after all items has been dropped on folder.
    We use the object parameter's parent to get all drag&drop items.
    Hope this info will help the others.

    MAPIFolder parentFolder = null;
    if (obj is DocumentItem)
    {
        parentFolder = (obj as DocumentItem).Parent as MAPIFolder;
    }
     if (obj is MailItem)
    {
       parentFolder = (obj as MailItem).Parent as MAPIFolder;
    }

    Thanks.


    • Marked as answer by 董建华 Tuesday, March 18, 2014 10:07 AM
    • Edited by 董建华 Tuesday, March 18, 2014 10:08 AM change
    Tuesday, March 18, 2014 10:07 AM