Restricting session mail with ConversationID

Status
Not open for further replies.

Jim H.

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
I have an Access database designed to track Work Orders for maintenance to properties. When an owner emails a request for maintenance, a work order is started. What the users of the database would like to do is track the email conversation associated with the Work Order.

In Access, I've linked to the InBox of the maintenance account in Outlook. In Microsoft's great wisdom, I'm not given access to the EntryID or ConversationID of a message, but with some hocus-pocus, I've managed to get the ConversationID. But I can't get Outlook to open a separate session that shows only the messages associated with that ID.

Here's the code I'm using:

strEmailAccount = DLookup("EmailAccount", "tblAdmin")

'Open Outlook session with emails restricted to the ConversationID
Set objOL = CreateObject("Outlook.Application") 'Create a new instance
strFilter = "[ConversationID] = '" & strConversationID & "'"
For Each objAccount In objOL.Session.Accounts
If objAccount = strEmailAccount Then
Set objStore = objAccount.DeliveryStore
Set objInbox = objStore.GetDefaultFolder(olFolderInbox)
Set objEmails = objInbox.Items.Restrict(strFilter)
objInbox.Display
End If
Next


What am I doing wrong, or is it even possible to use the Restrict method with ConversationID (can't find any documentation that says I can't).

Many thanks.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
The Restrict function returns the items matching the filter, it doesn´t change what is displayed in the folder. You´d have to use an MSForm with a listview control on it to display the items yourself.
 

Jim H.

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Thank you, Michael. This is my first foray into trying to control Outlook from MS Access (other than simply sending an email from within Access--I've done that many times). I failed to say in my first question that I'm getting an error message when the code reaches the .Restrict line (Set objEmails = objInbox.Items.Restrict(strFilter).

Here's the message: Error - 2147352567 (Condition is not valid.)

This led me to believe that I couldn't restrict on the ConversationID, but I couldn't find any documentation that said I couldn't. Can you tell me definitively whether I can use the Restrict method with this email property? Is my line of code valid?

When you say I have to use an "MSForm with a listview control," I assume you mean an Access form with that control on it. What I'd really like to do is let Outlook handle all the email functions. There could be several replies sent back and forth between the owner and the maintenance folks, so I'd like to display the conversation in an Outlook session--but only the emails associated with that conversation. Do I have to create my own Outlook form to do this?

On someone else's suggestion, I bought Sue Mosher's book Microsoft Outlook 2007 Programming. So far, I've not found the answer, but I haven't read the whole book yet, either. Someone has also suggested I use Redemption to get this done, so I downloaded and installed that, but haven't been able to make it work yet.

Still scratching my head, so if you could provide the code or point me to a website or book where I might find it, I'd be grateful.

Again, many thanks for your help.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
So you have two issues, 1) get the filter working, and 2) get the result displayed.

The object browser is a great source of help. Press f2 in the VBA environment, then switch from <All Libraries> to Outlook. Select Items left hand, and its Restrict function right hand. Press f1 for help. There´s a list of all properties that cannot be used with the Restrict function, or Find respectively.

ConversationIndex cannot be used, ConversationID is not mentioned. However, I tried it myself and get the same error. So I´d also conclude it´s not supported.

What about the ConversationTopic property? That one does work with the Restrict function.
 

Jim H.

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Michael, thanks again for responding. I've scoured the internet for an answer to this dilemma and can find nothing. I believe the ConversationTopic is a property that can be easily changed if someone in the conversation thread changes some component, say the Subject line. The ConversationID would remain the same, I think. I can get that number all day long through mailitem.GetConversation, but I can find no way to display ONLY the messages associated with that ConversationID. A great shortcoming in Outlook. Perhaps MS is working on it. If not, they should.

In the meantime, I'm creating a table in the Access database and copying every email to it (all the important parts), and controlling the sending of responses inside the database. I can associate all these entries with the correct Work Order, and provide the user with a conversation thread associated with that Work Order.

If you run across another solution, I'd love to hear about it. Again, many thanks for your help.

Jim H.
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Are you sure the ConversationID doesn´change? Since it´s computed, I´d expect it to change, too, when the topic is changed.

BTW: The Outlook object model doesn`t allow to change the topic, you´d need to dig deeper. And changing the subject has no effect on the Conversation.
 

Jim H.

New Member
Outlook version
Outlook 2010 32 bit
Email Account
IMAP
Ok, Michael. I'll look into that. I'd much rather have Outlook handle all the email requirements. Many thanks.
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
S rule, automatic replies, restricting them to within the company Using Outlook 1
J Restricting access to certain features for specific users BCM (Business Contact Manager) 3
F Re: Restricting Database Access Using RBAC Exchange Server Administration 4
B Re: Restricting Database Access Using RBAC Exchange Server Administration 3
K Restricting Outgoing Email Using Outlook 1
J Advanced RBAC - restricting delegate configuration Exchange Server Administration 1
L Cannot open PST file for first session each day Using Outlook 6
M McAllister Outlook stops Sending/Receiving/Synching after disconnecting remote desktop session Using Outlook 2
D Creating an outlook session from Access vba but run silently. With A specific profile Outlook VBA and Custom Forms 1
M VBA Auto-Reply code for Two Mailboxes on one Outlook Session. Outlook VBA and Custom Forms 4
A Mapi session exceeded the maximum of 32 objects of type "session". Using Outlook 6
S Outlook Web App ECP Session Timeout Exchange Server Administration 2
2 How to kill and open user session Exchange Server Administration 7
B Outlook XP does not remember password from session to session Using Outlook 2
A OWA Authentication: Public session vs. Private session Using Outlook 25
S Failed to create an RDO session instance: Class not registered Outlook VBA and Custom Forms 1
P CDO MAPI Session failing to retrieve user name but Getexchage user Outlook VBA and Custom Forms 2
ThinkToday Calculate reply time of outlook mail Using Outlook 1
B Outlook 2010 Opening Mail Attachment Using Outlook 2
e_a_g_l_e_p_i Is it possible it set the fonts used to read incoming mail Using Outlook 11
D Mail in Sent Items Gone Using Outlook 13
M Managing Gmail "All Mail" sync issues with IMAP Using Outlook 1
GregS Outlook 2016 Sent Mail absent from Sent Mail or Sent Items Folders Using Outlook 4
GregS Why is Outlook 2016 mail in Outlook.com? Using Outlook 1
S Outlook not receiving mail Using Outlook 2
Commodore Outlook (2013) issues with icloud.com mail Using Outlook 0
GregS Outlook 2016 iPhone won't download Outlook 2016 Mail. Using Outlook 0
A Arthur needs help with 2007 Outlook e-mail Using Outlook.com accounts in Outlook 3
oliv- How to distinguish whether mail is incoming or outgoing? Outlook VBA and Custom Forms 2
W Receiving mail for account that has been deleted Using Outlook 2
H In outlook 365 POP mail Inbox, email takes a long time or never arrives. Using Outlook 1
Z Add text to auto-forwarded e-mail Outlook VBA and Custom Forms 4
K HOW TO FIX AOL MAIL ISSUES? Using Outlook 0
O How to prevent CC from showing when creating a new mail? Using Outlook 1
I Junk Mail and PersonMetadata Using Outlook 2
T 3 months of archived e-mail is missing Using Outlook 1
B Outlook - Mail from safe senders list being sent to Spam Folder Using Outlook 0
G Detect Google Drive and OneDrive links in incoming mail Outlook VBA and Custom Forms 3
M Sent mail not showing in Sent Items folder; but they can be found with Search Using Outlook 3
H Outlook 2016 sent over 30 copies of an e-mail with attachments Using Outlook 1
T Missing text in e-mail message after "(Please keep confidential)" Using Outlook 3
Victor_50 Outlook 2013 Custom Contact Form starts with "E-mail 2" Outlook VBA and Custom Forms 2
E Mail sorting view issue Using Outlook 1
D after delete mail, open the next one Outlook VBA and Custom Forms 0
RBLampert Assigning a newly (re)created e-mail account to a specific .pst data file Using Outlook 2
B Clear Offline Items (Mail Folder) via VBA Outlook VBA and Custom Forms 1
M Moving mail to another folder is much slower than before (Office365) Using Outlook 0
A Outlook macro to create search folder with mail categories as criteria Outlook VBA and Custom Forms 3
N VBA Script to Open highlighted e-mail and Edit Message Outlook VBA and Custom Forms 5
M Auto-export mail to Excel Outlook VBA and Custom Forms 2
Similar threads


















































Top