Solved

Displaying a message box when dropping emails into another folder

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

Report: Liquid Web beats Amazon, Rackspace & More

A study by performance analyst firm Cloud Spectator finds that Liquid Web beats rivals Amazon, Rackspace and DigitalOcean when it comes to website and cloud application performance.

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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:
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

737 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