Solved

Copy/Move sent items to another folder

Posted on 2006-06-29
12
3,265 Views
Last Modified: 2008-01-09
Hello,

I have people who are using their personal mailbox and a group shared mailbox (Exchange). When they are sending on behalf of the group mailbox the message goes to their peronal "sent items" folder. I understand this is how microsoft designed it. What I'm trying to do it write a VBA rule that copy those items sent on behalf of the group mailbox back to the "sent items" of the group mailbox. The rule wizard doesn't allow to filter on the "from" field and the only event I could find was "Application_ItemSend" which is triggered before the item is actually sent.

Any clues would be welcome.

Thanks Damien
0
Comment
Question by:dleuba
[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
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 16

Expert Comment

by:Wadski
ID: 17016078
Hi there dleuba,


Im not a VBA expert and certailnly not skilled to answer the question the way you wish to solve your problem.

BUT have you looked at the Message Rules ?  (Tools / Rules & Alerts...)  From here you should be able to create a rule to move the mail after the message has been sent without the need for a VBA app.

Wadski
0
 

Author Comment

by:dleuba
ID: 17016164
Thanks Wadski, Yes I had a look at the rule wizard. The problem is you cannot filter e-mail by the "From" field.
0
 
LVL 16

Expert Comment

by:Wadski
ID: 17016172
You can base the rule on if it is sent from a SPecified account account though.  Which should be different for the group account from the personal accounts.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 76

Expert Comment

by:David Lee
ID: 17019188
Greetings, dleuba.

I can do this.  How can I pick those messages out from the rest?

Cheers!
0
 

Author Comment

by:dleuba
ID: 17023248
Hi Wadski,
Thanks again but when using outlook with an exchange server you only have one account or at least that's what I have. Therefore cannot use the account to filter them. Also you send email from the mailbox using a send on-behalf and not directly from the shared account.

Hi BlueDevilFan,
'm not sure I understand your point. But if you know how can you post the VBA code so I can try it out.

Regards,
Damien
0
 
LVL 76

Expert Comment

by:David Lee
ID: 17023736
Damien,

My question is how do I identify the messages sent on behalf of the public folder?  I have to know that in order to provide the code.  Unless you just want a code fragment and you'll fill in the missing portion.
0
 
LVL 3

Expert Comment

by:Lopo Pegado
ID: 17030084
You can just work aroun the problem, send the message in BCC to the shared mailbox.
Then you create a rule at that mailbox to messages incoming from that useres.

Hope it Helps

Best Regards

Botas
0
 

Author Comment

by:dleuba
ID: 17120086
Dear Admin,
Please close this thread as I was finally able to write some code which did what I wanted.
Regards,
Damien
0
 

Expert Comment

by:wlg1477
ID: 17267277
Hi Damien,

I am running into the same issue you had posting to sent items of a shared folder while using an Exchange email server.  Can you post your resolution?  It would be very helpful.

Thanks,
Will
0
 

Author Comment

by:dleuba
ID: 17537296
Hi Will,
Sorry for the late reply. I didn't check the thread after requesting the close of the thread. Find the code I'm using below Hope it helps.
Cheers Damien

Function getStoreFolderID(StoreName)
   Dim Store As Object
   Dim StoreFolder As Object
   Dim i As Integer
   Set Store = Application.GetNamespace("MAPI").Folders
   For Each StoreFolder In Store
      If StoreFolder Is Nothing Then
         MsgBox "Cannot get first Folder object"
         Exit For
      End If
      If StoreFolder.Name = StoreName Then
         For i = 1 To StoreFolder.Folders.Count
            If StoreFolder.Folders(i).Name = "Sent Items" Then
                entryID = StoreFolder.Folders(i).entryID
                storeID = StoreFolder.Folders(i).storeID
                Exit For
            End If
         Next
         Exit For
      End If
   Next
   Set Store = Nothing
   Set StoreFolder = Nothing
End Function

Public Sub Application_Startup()
   'Retrieve ID for accessing non-default store folder
   getStoreFolderID ("Mailbox - Shared, Mailbox")
   'Debugging: to check if the right folder is accessed. (open folder in new window)
   'Dim myNewFolder As Object
   'Set myNewFolder = Outlook.Application.Session.GetFolderFromID(entryID, storeID)
   'myNewFolder.Display
   ' Reference the items in the Sent Items. Because myOlItems is declared
   ' "WithEvents" the ItemAdd event will fire below.
   Set myOlItems = Outlook.Session.GetDefaultFolder(olFolderSentMail).Items
End Sub

Private Sub myOlItems_ItemAdd(ByVal Item As Object)
   If TypeName(Item) = "MailItem" Then
      If Item.SentOnBehalfOfName = "Shared, Mailbox" Then
         Set DestFolder = Outlook.Application.Session.GetFolderFromID(entryID, storeID)
         Item.Move (DestFolder)
      End If
   End If
End Sub
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 17729124
PAQed with points refunded (500)

Netminder
Site Admin
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this article I discuss my selections of the Top Four free Outlook OST File Viewers available. Open, view and read even damaged OST files by using these tools. They all provide a clear preview of all data such as emails, notes, tasks, calendars, e…
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…
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…

624 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