How far can VBA go?

G

Guest

Hey there guys.

I have a question that came with Robert's (Roady) great SaveAttachment macro.
http://www.howto-outlook.com/howto/saveembeddedpictures.htm

I wanted to know if it was possible to keep the original attachment
filenames instead of Outlook renaming them to image001.jpg, image002.jpg, and
so on. He said it was with a little bit of programming. So I ask: how far can
VBA for Outlook go? I mean, how much can I customize Outlook with VBA?

I was wondering, for example, if I could improve Outlook's conversation
parsing so it groupped e-mails by conversation more accurately. Some clients
that other people use change the subject on reply and Outlook thinks the
coversation has changed. This is very common with Yahoo! Groups. The original
subject is "[MyGroup] The Subject" and Outlook understands "RE: [MyGroup] The
Subject"
correctly, but some clients do "[MyGroup] Re: The Subject" and Outlook puts
it as another conversation.

I was wondering if I could improve Outlook's parsing so that it ignored any
"Re:", "Fw:". I was also wondering if I could change the conversations group
sorting from "Received" to "Sent".

I am willing to learn VBA to customize Outlook anyway, but I thought asking
the experts before I found out myself would be no harm. :)

Thank you,
Andre
 
K

Ken Slovak - [MVP - Outlook]

Conversation grouping doesn't rely on the subject, mostly it relies on
ConversationTopic and then ConversationIndex to thread the messages. If a
server doesn't preserve those properties or correctly add the new date blob
to the ConversationIndex value then the threading won't work. I'd imagine
that the yahoo emails aren't preserving those properties or are munging
them.

If you look at the settings for the By Conversation view you will see that
it sorts by Conversation and then by ConversationIndex, not by dates at all.
ConversationIndex adds a new blob (as I recall it's 8 bytes long) for each
new message in a thread. That blob is just a Windows date/time struct
appended to the existing ConversationIndex.
 
G

Guest

Well, maybe not exactely Yahoo, but the clients people use to write their
e-mails. I've noticed that the conversation breaks when certain people reply.

I've never heard of these properties. How does Outlook get them?

So, if I can't change that, could I write my own view mode? My own sorting
algorithm?

Thank you
Andre

Ken Slovak - said:
Conversation grouping doesn't rely on the subject, mostly it relies on
ConversationTopic and then ConversationIndex to thread the messages. If a
server doesn't preserve those properties or correctly add the new date blob
to the ConversationIndex value then the threading won't work. I'd imagine
that the yahoo emails aren't preserving those properties or are munging
them.

If you look at the settings for the By Conversation view you will see that
it sorts by Conversation and then by ConversationIndex, not by dates at all.
ConversationIndex adds a new blob (as I recall it's 8 bytes long) for each
new message in a thread. That blob is just a Windows date/time struct
appended to the existing ConversationIndex.




Andre said:
Hey there guys.

I have a question that came with Robert's (Roady) great SaveAttachment
macro.
http://www.howto-outlook.com/howto/saveembeddedpictures.htm

I wanted to know if it was possible to keep the original attachment
filenames instead of Outlook renaming them to image001.jpg, image002.jpg,
and
so on. He said it was with a little bit of programming. So I ask: how far
can
VBA for Outlook go? I mean, how much can I customize Outlook with VBA?

I was wondering, for example, if I could improve Outlook's conversation
parsing so it groupped e-mails by conversation more accurately. Some
clients
that other people use change the subject on reply and Outlook thinks the
coversation has changed. This is very common with Yahoo! Groups. The
original
subject is "[MyGroup] The Subject" and Outlook understands "RE: [MyGroup]
The
Subject"
correctly, but some clients do "[MyGroup] Re: The Subject" and Outlook
puts
it as another conversation.

I was wondering if I could improve Outlook's parsing so that it ignored
any
"Re:", "Fw:". I was also wondering if I could change the conversations
group
sorting from "Received" to "Sent".

I am willing to learn VBA to customize Outlook anyway, but I thought
asking
the experts before I found out myself would be no harm. :)

Thank you,
Andre
 
K

Ken Slovak - [MVP - Outlook]

Outlook creates those properties. Every new email has a ConversationTopic,
if it's a reply or reply all then it uses the ConversationTopic of the
preceding item. ConversationIndex starts out with one date/time blob and
adds additional ones for each message in the thread. Other mail programs
that don't preserve those properties don't produce messages that thread
properly. If all users are using Outlook and the properties are preserved
the conversations will thread properly.

You can write whatever you want. Whether the properties you select to work
with are preserved across threads still will depend on the mail clients used
and the mail servers the emails pass through.
 
G

Guest

Thank you very much for your explanation, Ken. One thing that is still not
clear to me is where Outlook gets these properties for the e-mails I receive
(not the ones I send). I have never seen them on the headers, and I believe
they are not meant to be there, right?

Can I modify these properties when I receive the e-mail? I was looking at
one my folders with 1000+ e-mails and I've noticed that the threads break
exactely in the situation I described on my first message, when the some
client adds "Re:" somewhere other than the beggining of the subject. So
someone, maybe Yahoo, maybe my ISP, maybe the user's client (as I said, I
don't know where Outlook gets those properties from) is creating the
ConversationTopic based on messages' subject.

Well, I know if all users used Outlook I wouldn't have problems with threads
breaking, but I can't force everyone to use it. As I can't change the list
from Yahoo to another place. And having the conversations the way it is now
is a little bit useless. So I wouldn't mind writing my own grouping/sorting
method, not based on Outlook's conversation but specific for lists that don't
obey the Conversations properties (are they MS proprietary?). Or I could
force a ConversationTopic on received messages, but I've read somewhere that
this property is read-only, so it wouldn't do any good.

Thank you again,
Andre
 
K

Ken Slovak - [MVP - Outlook]

I suppose for ConversationTopic if the receiving server recognizes either
"urn:schemas:httpmail:thread-topic" or "urn:schemas:mailheader:thread-topic"
and for ConversationIndex recognizes "urn:schemas:mailheader:thread-index"
that the properties are preserved in a round trip.

ConversationTopic is read-only to the Outlook object model. If that's been
changed then you're out of luck. If it's a matter of ConversationIndex,
which determines the place in the conversation then you can change that
property. However, there are no guarantees when the emails go outside of a
pure Exchange environment.

I haven't done much work with those properties outside of an Exchange
environment so I don't know if they are part of an RFC for emails or not. I
suppose you could look that up. Even if the properties are part of an RFC
each mail server might implement them differently or handle threading in
them differently.
 
G

Guest

Thank you again, Ken.

Ken Slovak - said:
ConversationTopic is read-only to the Outlook object model. If that's been
changed then you're out of luck. If it's a matter of ConversationIndex,
which determines the place in the conversation then you can change that
property. However, there are no guarantees when the emails go outside of a
pure Exchange environment.

Well, what I wanted to do, and I haven't looked that out on the book yet, is
if I could write another grouping/sorting mechanism that had nothing to do
with current Outlook's Conversation. That way I could completely ignore
ConversationTopic and ConversationIndex and create my own method based solely
on subject and sent date. This way I wouldn't have to worry about those
properties being changed on an environment outside Exchange.

I really don't know if I can customise Outlook that much. As much as
actually creating a whole new option on the "View Modes" menu. That would be
my first step into creating the most perfect e-mail client ever! Second in
line is making Outlook open a folder and select the oldest unread message in
there, instead of opening the message at the bottom of the folder by default.
A minor customization. ;)

Thank you again for all you help.
Andre
 
K

Ken Slovak - [MVP - Outlook]

Again, it all depends on a lot of different mail servers and email clients,
so I'm not sure any solution would ever work on all the variations you will
see.

You certainly can add user properties to any Outlook item but they won't be
preserved unless both parties are using Outlook and you take special
measures to send out the items using Rich Text and that adds a winmail.dat
attachment for users without Outlook. And you have to jump through hoops to
get Rich Text sent over the Internet.

You can add custom x-headers to outgoing emails but those might not be
preserved when round-tripping, so that's not a solution you can rely on
either. And even if they are preserved the receiving mail client would need
to know how to change the x-headers to preserve the threading.

I think you'd have to re-invent email and get your standards applied to
every single email client and mail server to have a prayer of doing what you
want. Good luck with that.
 
G

Guest

Ken, I am sorry. There is a terrible misunderstanding. I think I haven't made
myself clear enough. Well, it is OK, I think I'll probably find out the
answers to my questions myself.

I never intended to create another property and force it on other clients.
That was the misunderstanding. I was trying to create a whole new view mode
based on the subject and sent fields (both found in the headers). Completely
independent of other clients, I would parse these two fields locally, my own
way, and group messages based on them. In fact, that was my intention the
whole time, to create an algorithm that would group messages toghether
independently of other clients.

I am not sure you are familiar with GMail. It always threads the messages
correctly, independently of what client was used to write to you. I use GMail
a lot, I have 2 GB of mails in there and I have never seen it thread messages
incorrectly. I know how they do it and I was trying to do the same with
Outlook. It is not difficult, but I don't know if it is possible.

Andre
 
K

Ken Slovak - [MVP - Outlook]

I don't know gmail so I have no idea how they do threading. You can
certainly create a view and group the view by sender, subject, received
and/or sent time, up to 4 groupings.
 

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