A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Deleting Duplicate Mailitems



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 30th 06, 11:01 AM posted to microsoft.public.outlook.program_vba
Geoff
external usenet poster
 
Posts: 21
Default Deleting Duplicate Mailitems

Which Mailitem property stores the fact that a received Mailitem has been
replied to?

I need to distinguish programatically between duplicate Mailitems:

1. Some mailitems show "You replied on ... Click here to find all related
messages".
2. Duplicate mailitems in the same folder are exactly the same except
they do not show the above message.

I have written a VBA program that scans thousands of emails in multiple
stores and folders. The program finds duplicate Mailitems in the same folder
(by comparing SenderName, To, ReceivedTime, SentOn, Subject and
Attachments.Count). I want to delete the duplicates that don't show the "You
replied on..." message. I hope there's a property that stores this "replied"
information. Does it exist? Is there a way to distinguish?

TIA
Geoff



Ads
  #2  
Old August 30th 06, 03:54 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Deleting Duplicate Mailitems

The property you're looking for isn't exposed in the Outlook object model.
It's in PR_LAST_VERB_EXECUTED (0x10810003), where replied to is 102. You'd
need to be using CDO 1.21 or Extended MAPI or a MAPI wrapper such as
Redemption (www.dimastr.com/redemption) to get at it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Geoff" wrote in message
...
Which Mailitem property stores the fact that a received Mailitem has been
replied to?

I need to distinguish programatically between duplicate Mailitems:

1. Some mailitems show "You replied on ... Click here to find all
related messages".
2. Duplicate mailitems in the same folder are exactly the same except
they do not show the above message.

I have written a VBA program that scans thousands of emails in multiple
stores and folders. The program finds duplicate Mailitems in the same
folder (by comparing SenderName, To, ReceivedTime, SentOn, Subject and
Attachments.Count). I want to delete the duplicates that don't show the
"You replied on..." message. I hope there's a property that stores this
"replied" information. Does it exist? Is there a way to distinguish?

TIA
Geoff




  #3  
Old August 30th 06, 09:27 PM posted to microsoft.public.outlook.program_vba
Geoff
external usenet poster
 
Posts: 21
Default Deleting Duplicate Mailitems

Hi Ken,

Many thanks. I'll give it a go tomorrow. I have CDO and Redemption
installed.

Thanks too for your previous help and book recommendations. Sorry I didn't
reply. In fact, I drafted a reply (ie some thoughts on Automation etc), but
thought twice before posting. I'm not sure comments (from my limited
perspective) are necessarily welcome to a more-knowledgeable wider audience.
I'll give it some more thought and maybe pluck up courage!

Thanks again.
Regards
Geoff


"Ken Slovak - [MVP - Outlook]" wrote in message
...
The property you're looking for isn't exposed in the Outlook object model.
It's in PR_LAST_VERB_EXECUTED (0x10810003), where replied to is 102. You'd
need to be using CDO 1.21 or Extended MAPI or a MAPI wrapper such as
Redemption (www.dimastr.com/redemption) to get at it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Geoff" wrote in message
...
Which Mailitem property stores the fact that a received Mailitem has been
replied to?

I need to distinguish programatically between duplicate Mailitems:

1. Some mailitems show "You replied on ... Click here to find all
related messages".
2. Duplicate mailitems in the same folder are exactly the same except
they do not show the above message.

I have written a VBA program that scans thousands of emails in multiple
stores and folders. The program finds duplicate Mailitems in the same
folder (by comparing SenderName, To, ReceivedTime, SentOn, Subject and
Attachments.Count). I want to delete the duplicates that don't show the
"You replied on..." message. I hope there's a property that stores this
"replied" information. Does it exist? Is there a way to distinguish?

TIA
Geoff






  #4  
Old October 15th 06, 01:42 AM posted to microsoft.public.outlook.program_vba
Geoff
external usenet poster
 
Posts: 21
Default Deleting Duplicate Mailitems

Hi Ken,

I'm making great progress thanks to your earlier help!

I have a couple of more questions, if I may.

Using VBA and CDO 1.21 in Outlook, I'm sending a MAPI.Fields collection for
an Outlook Mailitem to a function containing the following code:

Dim lngValue as Long
lngValue = &H10810003
Set objOneField = objMAPIFieldsColl.item(lngValue)

As you mentioned, if the Mailitem has been replied to, then
objOneField.Value is 102.

If the Mailitem has not been replied to, the last code line above generates
a run-time error.

My questions a

1. Am I right in assuming that the run-time error occurs because, when a
Mailitem has not been replied to, the field in question simply does not
exist? Can I trap the error and assume that the Mailitem has not been
replied to?

2. If a run-time error is not generated, I then get access to the field.
Do I have to ensure that its Value property is 102 before I can assume that
the Mailitem has been replied to? I'm wondering if the Value property could
contain other values that would mean other things.

Very many thanks for getting me this far.
Regards
Geoff


"Ken Slovak - [MVP - Outlook]" wrote in message
...
The property you're looking for isn't exposed in the Outlook object model.
It's in PR_LAST_VERB_EXECUTED (0x10810003), where replied to is 102. You'd
need to be using CDO 1.21 or Extended MAPI or a MAPI wrapper such as
Redemption (www.dimastr.com/redemption) to get at it.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Geoff" wrote in message
...
Which Mailitem property stores the fact that a received Mailitem has been
replied to?

I need to distinguish programatically between duplicate Mailitems:

1. Some mailitems show "You replied on ... Click here to find all
related messages".
2. Duplicate mailitems in the same folder are exactly the same except
they do not show the above message.

I have written a VBA program that scans thousands of emails in multiple
stores and folders. The program finds duplicate Mailitems in the same
folder (by comparing SenderName, To, ReceivedTime, SentOn, Subject and
Attachments.Count). I want to delete the duplicates that don't show the
"You replied on..." message. I hope there's a property that stores this
"replied" information. Does it exist? Is there a way to distinguish?

TIA
Geoff



  #5  
Old October 16th 06, 07:29 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Deleting Duplicate Mailitems

You can check for IsEmpty() for fields that may not be there by default.

There are other verbs that could be there in the field, such as
EXCHIVERB_REPLYTOALL or EXCHIVERB_FORWARD , so check for a value of 102.

EXCHIVERB_REPLYTOALL (103) is set if ReplyToAll was used last,
EXCHIVERB_FORWARD (104) is set if Forward was used last.

The value will change as different actions are taken. If an item was replied
to the field value would be 102. If then you forwarded the same item it
would change to 104. The field only captures the last action taken.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Geoff" wrote in message
...
Hi Ken,

I'm making great progress thanks to your earlier help!

I have a couple of more questions, if I may.

Using VBA and CDO 1.21 in Outlook, I'm sending a MAPI.Fields collection
for an Outlook Mailitem to a function containing the following code:

Dim lngValue as Long
lngValue = &H10810003
Set objOneField = objMAPIFieldsColl.item(lngValue)

As you mentioned, if the Mailitem has been replied to, then
objOneField.Value is 102.

If the Mailitem has not been replied to, the last code line above
generates a run-time error.

My questions a

1. Am I right in assuming that the run-time error occurs because, when
a Mailitem has not been replied to, the field in question simply does not
exist? Can I trap the error and assume that the Mailitem has not been
replied to?

2. If a run-time error is not generated, I then get access to the
field. Do I have to ensure that its Value property is 102 before I can
assume that the Mailitem has been replied to? I'm wondering if the Value
property could contain other values that would mean other things.

Very many thanks for getting me this far.
Regards
Geoff


  #6  
Old October 18th 06, 05:15 PM posted to microsoft.public.outlook.program_vba
Geoff
external usenet poster
 
Posts: 21
Default Deleting Duplicate Mailitems

Hi Ken,

Very many thanks.

The field only captures the last action taken.


It was important for me to know that to solve my present problem. Thanks for
that.

You can check for IsEmpty() for fields that may not be there by default.


Where am I going wrong please?

When the PR_LAST_VERB_EXECUTED property does not exist (in the MAPI fields
collection for an Outlook Mailitem), the following code line produces a
run-time error (not as I expected FALSE):

"If IsEmpty(objMAPIFields.item(&H10810003)) Then"

But if I precede the above code line with:

"On Error Resume Next"

then the IsEmpty() function returns TRUE.

How did you mean I should use IsEmpty() please and what's going on above?

Just FMI, where would the following detailed information be stored:
"You replied on 15/10/2006 01:52. Click here to find all related messages."

TIA, Regards
Geoff


"Ken Slovak - [MVP - Outlook]" wrote in message
...
You can check for IsEmpty() for fields that may not be there by default.

There are other verbs that could be there in the field, such as
EXCHIVERB_REPLYTOALL or EXCHIVERB_FORWARD , so check for a value of 102.

EXCHIVERB_REPLYTOALL (103) is set if ReplyToAll was used last,
EXCHIVERB_FORWARD (104) is set if Forward was used last.

The value will change as different actions are taken. If an item was
replied to the field value would be 102. If then you forwarded the same
item it would change to 104. The field only captures the last action
taken.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm





  #7  
Old October 19th 06, 03:38 PM posted to microsoft.public.outlook.program_vba
Ken Slovak - [MVP - Outlook]
external usenet poster
 
Posts: 5,848
Default Deleting Duplicate Mailitems

Use the On Error Resume Next before testing for IsEmpty.

ConversationIndex and ConversationTopic. All items in a thread have the same
ConversationTopic and each one gets a Windows time struct of 8 bytes
appended to the previous ConversationIndex.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Geoff" wrote in message
...
Hi Ken,

Very many thanks.

The field only captures the last action taken.


It was important for me to know that to solve my present problem. Thanks
for that.

You can check for IsEmpty() for fields that may not be there by default.


Where am I going wrong please?

When the PR_LAST_VERB_EXECUTED property does not exist (in the MAPI fields
collection for an Outlook Mailitem), the following code line produces a
run-time error (not as I expected FALSE):

"If IsEmpty(objMAPIFields.item(&H10810003)) Then"

But if I precede the above code line with:

"On Error Resume Next"

then the IsEmpty() function returns TRUE.

How did you mean I should use IsEmpty() please and what's going on above?

Just FMI, where would the following detailed information be stored:
"You replied on 15/10/2006 01:52. Click here to find all related
messages."

TIA, Regards
Geoff


  #8  
Old October 19th 06, 05:21 PM posted to microsoft.public.outlook.program_vba
Geoff
external usenet poster
 
Posts: 21
Default Deleting Duplicate Mailitems

Very many thanks.
I see - neat.
I think I'm nearly home and dry.
Where would we be without people like you?
Quite lost!
I'm very grateful.
Regards
Geoff

"Ken Slovak - [MVP - Outlook]" wrote in message
...
Use the On Error Resume Next before testing for IsEmpty.

ConversationIndex and ConversationTopic. All items in a thread have the
same ConversationTopic and each one gets a Windows time struct of 8 bytes
appended to the previous ConversationIndex.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Geoff" wrote in message
...
Hi Ken,

Very many thanks.

The field only captures the last action taken.


It was important for me to know that to solve my present problem. Thanks
for that.

You can check for IsEmpty() for fields that may not be there by default.


Where am I going wrong please?

When the PR_LAST_VERB_EXECUTED property does not exist (in the MAPI
fields
collection for an Outlook Mailitem), the following code line produces a
run-time error (not as I expected FALSE):

"If IsEmpty(objMAPIFields.item(&H10810003)) Then"

But if I precede the above code line with:

"On Error Resume Next"

then the IsEmpty() function returns TRUE.

How did you mean I should use IsEmpty() please and what's going on above?

Just FMI, where would the following detailed information be stored:
"You replied on 15/10/2006 01:52. Click here to find all related
messages."

TIA, Regards
Geoff




 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting duplicate diary entries ??? Hi-Soft Outlook - General Queries 0 August 26th 06 05:37 PM
Deleting Duplicate holidays Charles C. Perkins Outlook - Calandaring 3 August 17th 06 08:51 PM
How To: select mailitems from my inbox? NFR Outlook - Using Forms 1 May 16th 06 04:41 PM
How to work with MailItems after pressing Send-Button Darius Add-ins for Outlook 5 January 20th 06 04:27 PM
Deleting a Custom From Chaplain Doug Outlook - Using Forms 1 January 12th 06 05:25 AM


All times are GMT +1. The time now is 11:21 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.