Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Copy/Move sent items to another folder

Posted on 2006-06-29
12
Medium Priority
?
3,353 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
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

This article lists the top 5 trialware 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 other critical issues with Exchange server or impo…
Are you looking for the options available for exporting EDB files to PST? You may be confused as they are different in different Exchange versions. Here, I will discuss some options available.
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 …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

916 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