Solved

Displaying a message box when dropping emails into another folder

Posted on 2008-06-19
2
236 Views
Last Modified: 2008-12-31
I want to display a message displaying wether or not an email is archived if a user tries to drag & drop it from their inbox into another folder in Outlook.
I do not seem to be able to record a maco in Outlook & the only code I have found that I may be able to adapt is the following:

Dim objOrig As Outlook.MailItem, objCopy As Outlook.MailItem
Dim objDestinationFolder As Outlook.MAPIFolder

'This will prompt you to choose a folder where you want to copy the message to
Set objDestinationFolder = Application.GetNamespace("MAPI").PickFolder

If objDestinationFolder Is Nothing Then Exit Sub

Set objOrig = Application.ActiveExplorer.Selection.Item(1)
Set objCopy = objOrig.Copy
objCopy.Move objDestinationFolder
objOrig.Delete

Set objOrig = Nothing
Set objCopy = Nothing
Set objDestinationFolder = Nothing

However, I do not need an explorer to show, or to pick the folder again, I just a message saying the email is archived if the message class of the email they are dragging = IPM.Note.arch2 & then not allowing the user to perform the drag drop action.

Anyone have any ideas where I can look or any useful documentation please?
Many thanks
AndyC
0
Comment
Question by:AJCorbett72
2 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 21847520
Hi, AJCorbett72.

This isn't possible in the way you describe.  When an item is added to a folder, without regard to how it was added (i.e. copied via menu selections or via drag-n-drop), there's only one event that's fired and it does not have the ability to cancel the action.  The event that fires is ItemAdd.  Using it we could test the item type and display a dialog-box, but we can't stop the item from being added to the folder.  Unless you just want to delete it.  That's possible, but it runs the risk of losing the item if the user executed a move instead of a copy.  I can provide the code showing how to trap ItemAdd and take action, I just cna't provide you with a means of halting the action.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Read about why website design really matters in today's demanding market.
Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now