Solved

Displaying a message box when dropping emails into another folder

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Many people use more than one email account and so it becomes difficult for them to manage them when they use separate accounts,  so, in this article, I have shared an easy way to add Other Mail Accounts in your Google Inbox. It helps to combine all…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Many of my clients call in with monstrous Gmail overloading issues with Outlook. A quick tip is to turn off the All Mail and Important folders from synching. Here is a quick video I made to show you how to turn off these and other folders in Gmail s…

815 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

8 Experts available now in Live!

Get 1:1 Help Now