Retrieving email item

E

Edward

Hi,
I have a userform with a list that keeps email EntryId, Sendername, Subject
, Recieved date.
EntryID which is a 140 long string is in the first column (0) and is hidden.
A simplified version of my code is :

sub done()
Dim msg As Outlook.MailItem
Dim nms As Outlook.NameSpace
Dim fld As Outlook.MAPIFolder

Set msg = nms.GetItemFromID(lstQueue.List(indx, 0)) <- generates error


With msg
.Subject = "DONE - "
.Display

End With

End sub

lstQueue.List(indx, 0)) correctly keeps the EntryID , but the line I showed
with an arrow generates an error "Object variable or with block not set" .
I can't figure out what's wrong , Any help will be greatly appriciated.

I don't know if the reason for this error is not useing the storeID ?
 
E

Edward

I think I have to explain more about what I’m trying to do . Ideally after
I receive an email and keep it’s EntryID in my listbox , usually there are
several back and fort email’s in the same thread (Reply) Is there a way to
catch all the email’s that are part of this thread?
Example :
First email :A send an email to B for a job request.
Seoncd email :B replies with a question
Third email :A replies with answer
Fourth email : B finishes the job and replies with an email

Is it a way to keep track of the most recent email in the same thread ? It’s
easier to always work with the original email using it’s entryID , but
because EntryID changes each time we reply to the original email I don’t know
how to find the following emails and always reply to the most recent one?
 
K

Ken Slovak - [MVP - Outlook]

I'd separate that line into two, the first one getting the EntryID from your
list object as a string. Then you can see if you are getting an actual
value. The line you indicate should cause no errors unless indx or your list
object aren't set correctly before you call GetItemFromID. You also might
not have set "nms" as the NameSpace object. It's hard to tell from
abbreviated code. Are you setting "nms", I don't see that.

Don't rely on an EntryID having any specific number of characters, it can
vary widely.
 
K

Ken Slovak - [MVP - Outlook]

All items in a thread share the same ConversationTopic property. Each new
item adds a new date/time structure to the end of the ConversationIndex
property, so the longer that property is the further down in the
conversation it is, the shorter the nearer the start of the conversation.
 
E

Edward

Thanks Ken, I think conversation topic is the same as subject which is not
gonna be helpful because users change the subject when they reply.

I tested with conversationIndex here is the result
Original email recived
01C9D89635023F68E01D8F084ACD84E660C598661781

Reply
01C9D89635023F68E01D8F084ACD84E660C59866178100002CE980

Reply to reply
01C9D89635023F68E01D8F084ACD84E660C598661781000025AFB0000015B880

As you mentioned each time we reply it adds a string to the previous string
, how ever the only part which remains constant is the original string up to
…781 and after that text changes . I send these data to Excel for some
reporting purposes and I think I can find connection between them possibly by
using instr()
I have three questions.
1)You mentiones the addition string to the original conversationindex has
datetime structure , can we somehow use them? Like retrieve a date from it ?
2)Is conversationindex same as EntryId?
3)Assuming I have a conversationindex how can I find that specific email
among hundreds of emails in my inbox and display it?


--
Best regards,
Edward


Ken Slovak - said:
All items in a thread share the same ConversationTopic property. Each new
item adds a new date/time structure to the end of the ConversationIndex
property, so the longer that property is the further down in the
conversation it is, the shorter the nearer the start of the conversation.
 
K

Ken Slovak - [MVP - Outlook]

Even if users in a conversation change the subject the original
ConversationTopic will remain the same. That's how Outlook can show the By
Conversation view.

Neither ConversationTopic nor ConversationIndex are at all the same as
EntryID.

ConversationTopic can be used in a filter or restriction on the Items
collection of a folder, so you can filter items in that Items collection by
that property. If items are scattered in different folders you would have to
repeat that in each of those folders.

An alternative approach would be to use an AdvancedSearch and set up a
search string for that ConversationTopic. That can be set to run on any
arbitrary set of folders and to return a unified set of results from all the
target folders.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top