Solved

Copy/Move sent items to another folder

Posted on 2006-06-29
12
3,210 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
  • 4
  • 2
  • 2
  • +3
12 Comments
 
LVL 16

Expert Comment

by:Wadski
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Greetings, dleuba.

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

Cheers!
0
 

Author Comment

by:dleuba
Comment Utility
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
Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

 
LVL 76

Expert Comment

by:David Lee
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
PAQed with points refunded (500)

Netminder
Site Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
Use email signature images to promote corporate certifications and industry awards.
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 …
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now