Solved

Displaying a message box when dropping emails into another folder

Posted on 2008-06-19
2
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

690 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