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


>
 
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
P Email address auto-completes work fine on laptop, but no longer on desktop Using Outlook 2
S Create Outlook Task from Template and append Body with Email Body Outlook VBA and Custom Forms 4
H Copying email address(es) in body of email and pasting in To field Outlook VBA and Custom Forms 1
A Search folder and move the email Outlook VBA and Custom Forms 0
P VBA to add email address to Outlook 365 rule Outlook VBA and Custom Forms 0
farrissf Outlook 2016 Optimizing Email Searches in Outlook 2016: Seeking Insights on Quick Search vs Advanced Search Features Using Outlook 0
D Delete selected text in outgoing email body Outlook VBA and Custom Forms 0
F Graphics in email / Mac recipient garbled Using Outlook 0
D Outlook VBA forward the selected email to the original sender’s email ID (including the email used in TO, CC Field) from the email chain Outlook VBA and Custom Forms 2
Witzker Outlook 2019 Macro to seach in all contact Folders for marked Email Adress Outlook VBA and Custom Forms 1
E Outlook 365 Save Selected Email Message as .msg File - oMail.Delete not working when SEARCH Outlook VBA and Custom Forms 0
S Email Macros to go to a SHARED Outlook mailbox Draft folder...NOT my personal Outlook Draft folder Using Outlook 2
R Outlook 365 VBA AUTO SEND WITH DELAY FOR EACH EMAIL Outlook VBA and Custom Forms 0
G Print email attachments when hit subfolder Outlook VBA and Custom Forms 1
C Spam Email? Using Outlook 2
G Automatically delete email when a condition is met Outlook VBA and Custom Forms 1
E Save Selected Email Message as .msg File - digitally sign email doesn't works Outlook VBA and Custom Forms 1
S Email was migrated from GoDaddy to Microsoft exchange. We lost IMAP ability Exchange Server Administration 1
R Outlook 365 How to integrate a third-party app with Outlook to track email and sms? Using Outlook 2
S Paperclip icon shows without attachment in email under Sent folder Using Outlook 0
B Outlook 2019 Automatically move email after assigning category Using Outlook 4
Rupert Dragwater How to permanently remove an email address Using Outlook 9
K vba code to auto download email into a specific folder in local hard disk as and when any new email arrives in Inbox/subfolder Outlook VBA and Custom Forms 0
F Auto changing email subject line in bulk Using Outlook 2
F Want to add second email to Outlook for business use Using Outlook 4
kburrows Outlook Email Body Text Disappears/Overlaps, Folders Switch Around when You Hover, Excel Opens Randomly and Runs in the Background - Profile Corrupt? Using Outlook 0
J Outlook 365 Outlook Macro to Sort emails by column "Received" to view the latest email received Outlook VBA and Custom Forms 0
A Outlook 2019 Help with forwarding email without mentioning the previous email sender. Outlook VBA and Custom Forms 0
J Macro to send email as alias Outlook VBA and Custom Forms 0
M Shift Delete doesn't delete email from server Using Outlook 3
K Incorporate selection from combobox into body of email Outlook VBA and Custom Forms 0
L Why are some email automatically going to "archive" Using Outlook 2
M Outlook Macro to save as Email with a file name format : Date_Timestamp_Sender initial_Email subject Outlook VBA and Custom Forms 0
B Outlook 2019 Custom Email form - Edit default email form Outlook VBA and Custom Forms 6
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0
T Problem when requesting to view an email in a browser Using Outlook 0
J Outlook 365 Forward Email Subject to my inbox when new email arrive in shared inbox Using Outlook 0
HarvMan Archive Email Manually Using Outlook 1
L Fetch, edit and forward an email with VBA outlook Outlook VBA and Custom Forms 2
S New Email "From" box stopped working Using Outlook 0
Rupert Dragwater Duplicate email in Folder Using Outlook 7

Similar threads

Back
Top