Solved

Displaying a message box when dropping emails into another folder

Posted on 2008-06-19
2
239 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Read this checklist to learn more about the 15 things you should never include in an email signature.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:

943 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

19 Experts available now in Live!

Get 1:1 Help Now