Solved

Copy/Move sent items to another folder

Posted on 2006-06-29
12
3,213 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
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
 
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Import empty folder structure from PST into Exchange O365 user mailbox? 6 74
cached or not 5 61
Outlook 2016 display images 14 43
Searching Outlook Email Archives 5 31
What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

929 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

14 Experts available now in Live!

Get 1:1 Help Now