novemberskye
Member
- Outlook version
- Outlook 2013 64 bit
- Email Account
- Office 365 Exchange
Hi All,
I am looking to track some data when mail items are moved in Shared mail account to any subfolders within the account.
the code below is fired via Items_ItemAdd(ByVal item As Object)
- I don't want this restriction. I would like to track every time an item is moved anywhere within the shared mail account.
Issues:
1. Working on one by one movement from Inbox to 'Actioned' folder but not for multiple selected items (it's adding the number of selection correctly but the data it's recording is the same as the first item)
2. Restricted to moving from Inbox to Actioned
Help needed:
1. Code to allow to get "from" and "to" folders within the mail account
1.1 Code to get "from" folder name and "to" folder name
2. Code to record mail item data allowing multiple selected mail items
Appreciate your help in advance!!!
I am looking to track some data when mail items are moved in Shared mail account to any subfolders within the account.
the code below is fired via Items_ItemAdd(ByVal item As Object)
- I don't want this restriction. I would like to track every time an item is moved anywhere within the shared mail account.
Issues:
1. Working on one by one movement from Inbox to 'Actioned' folder but not for multiple selected items (it's adding the number of selection correctly but the data it's recording is the same as the first item)
2. Restricted to moving from Inbox to Actioned
Help needed:
1. Code to allow to get "from" and "to" folders within the mail account
1.1 Code to get "from" folder name and "to" folder name
2. Code to record mail item data allowing multiple selected mail items
Appreciate your help in advance!!!
Code:
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.MAPIFolder
Dim olApp As Outlook.Application
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim itm As Object
Dim msg As Outlook.MailItem
Dim sTime As String
Dim sSubj As String
Dim sCat As String
Dim sConID As String
Set objNS = GetNamespace("MAPI")
Set objFolder = objNS.Folders("contoso@microsoft.com.au")
Set objFolder = objFolder.Folders("Inbox").Folders("Actioned")
Set db = DBEngine.OpenDatabase("S:\....\dbo.mailtrackinglog.accdb")
Set rs = db.OpenRecordset("tbl_mailmovements", dbOpenTable)
For Each msg In olApp.ActiveExplorer.Selection
Set msg = olApp.ActiveExplorer.Selection(1)
rcvdTime= msg.ReceivedTime
mSubj = msg.Subject
mConvId= msg.ConversationID
mCateg = msg.Categories
Next msg
with rst
.AddNew
.Fields( ) = rcvdTime
.Fields( ) = mSubj
.Fields( ) = mConvId
.Fields( ) = mCateg
.Update
End With