Retrieving email item

Status
Not open for further replies.
R

RWR3YXJk

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 ?

Best regards,

Edward
 
R

RWR3YXJk

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?

Best regards,

Edward

"Edward" wrote:


> 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 ?
> > Best regards,
> Edward
 
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.

"Edward" <Edward> wrote in message

news:53836A72-88E7-4D4D-9C49-7E50A1B40D80@microsoft.com...
> 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 ?
> > Best regards,
> Edward
 
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.

"Edward" <Edward> wrote in message

news:8CB594E0-5A74-4822-A47E-866082219178@microsoft.com...
> 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?

> > Best regards,
> Edward
 
R

RWR3YXJk

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
wrote:


> 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.

> >

>

> "Edward" <Edward> wrote in message
> news:8CB594E0-5A74-4822-A47E-866082219178@microsoft.com...
> > 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?
> > > > Best regards,
> > Edward


>
 
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.

"Edward" <Edward> wrote in message

news:E3C89928-C783-4DDE-A878-AA5AF7879C7A@microsoft.com...
> 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
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
V vBA for searching a cell's contents in Outlook and retrieving the subject line Outlook VBA and Custom Forms 1
D Retrieving Tables from outlook to excel Using Outlook 14
S Retrieving Deleted Outlook Contacts Using Outlook 2
R Outlook 2013 stalls when retrieving from Frontier POP3 Using Outlook 3
F Retrieving old BCM data BCM (Business Contact Manager) 5
J ModefiedForm page issues 1)retrieving available size of Modifiedfo Outlook VBA and Custom Forms 3
A Retrieving CalendarView for Outlook 2003 Outlook VBA and Custom Forms 4
A Retrieving work week (start/end times) from outlook with VBA Outlook VBA and Custom Forms 5
L Retrieving the DisplayFormat for a UserProperty using VB Outlook VBA and Custom Forms 3
A Links in email getting error message about group policy Using Outlook 4
richardwing Auto forward email that is moves into a specific outlook folder Outlook VBA and Custom Forms 2
J Recommendations for Outlook Duplicate Email Remover Using Outlook 6
Geldner Tweak Junk Email Reporting tool to default to particular email on send? Using Outlook 3
S Outlook 365 Can I change the possible range of highlighting colours when writing an Outlook email? Using Outlook 1
V Can one change the formatting of email title blocks? Using Outlook 0
P default font when sending email from browser Using Outlook 1
D VBA Macro to Print and Save email to network location Outlook VBA and Custom Forms 1
B IMAP server rejects sent email - cannot deliver messages Using Outlook 2
TedSch Small vba to kill political email Outlook VBA and Custom Forms 3
X Open Hyperlinks in an Outlook Email Message (Help with Diane's solution) Outlook VBA and Custom Forms 3
e_a_g_l_e_p_i Email notifications changed with Outlook 2021 Using Outlook 8
glnz How to retrieve or redo Verizon.net email password without affecting Outlook connection? Using Outlook 1
Z Copy specific email body text Outlook VBA and Custom Forms 0
D ISOmacro to extract active mail senders name and email, CC, Subject line, and filename of attachments and import them into premade excel spread sheet Outlook VBA and Custom Forms 2
M Outlook 365 refuses to send email Using Outlook 1
B Search and Find Email by Folder Name Outlook VBA and Custom Forms 2
K Closing external IMAP email... Outlook 2013 Using Outlook 0
L Capture email addresses and create a comma separated list Outlook VBA and Custom Forms 5
C Email bomb processing Outlook VBA and Custom Forms 1
O What would be the recommended way to change an email address (family member)? Using Outlook 0
A Outlook 2016 Macro to Reply, ReplyAll, or Forward(but with composing new email) Outlook VBA and Custom Forms 0
L Checking Sender Email Address for trusted domain from list on intranet Outlook VBA and Custom Forms 4
J How do you disable address search box when typing @ in body of email? Using Outlook 0
S HTML Code Embedded in String Within Open Outlook Email Preventing Replace(Application.ActiveInspector.CurrentItem.HTMLBody From Working Outlook VBA and Custom Forms 4
Victor.Ayala Automated way to check the option "Show this folder as an email Address Book" Outlook VBA and Custom Forms 2
D Wrong email address in Outlook 2003 "From" tab in new outgoing emails Using Outlook 4
D Forwarding email based on the attachment file type and specific text found on the attachment file name Outlook VBA and Custom Forms 1
F Forward incoming email with 4 embedded images in the body without original sender Outlook VBA and Custom Forms 22
W Macro to Filter Based on Latest Email Outlook VBA and Custom Forms 6
D Create advanced search (email) via VBA with LONG QUERY (>1024 char) Outlook VBA and Custom Forms 2
C Outlook 2007 Removing then adding account restores junk email processing Using Outlook 0
G Place jpg in body of email Outlook VBA and Custom Forms 1
F Wishlist Outlook suddenly began synchronizing deleted items every time I delete a single email. Using Outlook 2
N Save Selected Email Message as .msg File Outlook VBA and Custom Forms 12
HarvMan Toggle between calendar and email in Outlook 365 Using Outlook 12
F Email being marked as Spam by Gmail and not being visible in Outlook Using Outlook 5
G Email time stamp Using Outlook 2
G Schedule recurring email and attachments display Outlook VBA and Custom Forms 3
G Save and Rename Outlook Email Attachments Outlook VBA and Custom Forms 0
B Need to Copy an email to a subfolder Outlook VBA and Custom Forms 2

Similar threads

Top