Avatar of Jacque Scott
Jacque ScottFlag for United States of America

asked on 

Move Sent Item to a specified folder instead of Sent Folder

At my company  the managers Inbox is shared with their secretary.  Sometimes the manager will need to send a private email that they don't want their secretary to see.  I have set up an account for the user to use instead of their regular email.  

Item.SentOnBehalfOfName = JacqueS Private
When they are sending an email they will select this name in the From box.

The subfolder I want to save the sent emails to is called Sent_Private.  I have found how to save into another folder under the main Mailbox folder but I need it under the folder JacqueS Private which is at the same level as the main Mailbox folder.

This needs to be done automatically.  I can't setup a rule and it cannot be done manually.

Please help.
OutlookVBA

Avatar of undefined
Last Comment
Jacque Scott
Avatar of CompProbSolv
CompProbSolv
Flag of United States of America image

I'm not sure of the actual commands, but can suggest a general method for accomplishing it.

After sending the email, search for it in Sent Items and then move it to the appropriate folder.
The tricky part is in identifying the email.  I'd bet that if you matched the sender, the recipient, the time, and the subject, you'd be fairly certain to get it right every time.

Of course, there would be a very short time where it appeared in Sent Items and there's a chance that the secretary would see it.
Avatar of darbid73
darbid73
Flag of Germany image

I would be interested to know why you say rules do not work.

Here are your non-code options, which does say that adding a rule is an option.

Are you also willing to write VBA code or an addin for this task?
Avatar of Jacque Scott
Jacque Scott
Flag of United States of America image

ASKER

I should have said I was told I can't use the rules option.  I need to write a VBA program that will automatically run when an item is sent.
Avatar of darbid73
darbid73
Flag of Germany image

Have you found a solution to this problem?
Avatar of Jacque Scott
Jacque Scott
Flag of United States of America image

ASKER

No, I still have not found a solution.
to add in "thisoutlooksession" in macros (alt f11)

'=== trigger an event if an item is sent
Dim WithEvents colSentItems As Items

Private Sub colSentItems_ItemAdd(ByVal item As Object)
'=== modifier la catégorie avant d'envoyer un message
   If item.Class = olMail Then

    'move the item (mail) to your secret folder if it meet some parameters
         
   End If
End Sub

Open in new window


some message parameters to filter:
       dim mmessage As Outlook.MailItem
     suj_ok = mmessage.Subject
            msg_to_ok = mmessage.To
            msg_from_ok = mmessage.SenderName
            msg_cc_ok = mmessage.CC

Open in new window

you need to move the message: (do some testing, cause you can move it somewhere you might never find it)
Dim projetdir As Outlook.MAPIFolder
    Dim dos_rac As Outlook.NameSpace  '=== racine de tous les dossiers
    Set dos_rac = Outlook.GetNamespace("MAPI")

Set projetdir = dos_rac.Folders("userfolder").Folders("inbox").Folders("secretfolder"))
mmessage.Move projetdir

Open in new window


if your VBA is not good enough, i'll do a functional code and test it

since i did not test, maybe you will have to do a copy of the message before moving it, then deleting the original
mescopy = mmessage.copy
move it
delete original
Avatar of Jacque Scott
Jacque Scott
Flag of United States of America image

ASKER

Thank you Serge.  I'm working on it now.  I am not good at VBA but I'll try it first.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Serge Fournier
Serge Fournier
Flag of Canada image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Jacque Scott
Jacque Scott
Flag of United States of America image

ASKER

I still haven't been able to get back to this project but I want to close this question out.

Thank you for all your help.
Outlook
Outlook

Microsoft Outlook is a personal information manager from Microsoft, available as a part of the Microsoft Office suite. Although often used mainly as an email application, it also includes a calendar, task manager, contact manager, note-taker, journal, and web browser.

105K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo