?
Solved

Copy/Move sent items to another folder

Posted on 2006-06-29
12
Medium Priority
?
3,326 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
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…
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…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 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