programmatically create folders to sort incoming mail

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

Hi Everybody

Is there a way to sort Ms Outlook 2000 incoming mail, into folders that can be created as needed
programatically and then when I receive further emails with the same subject part (a number) they
automatically go into the some folder as earlier emails that are concering the same number.

The criteria for creating a new folder is if outlook recognises a new Item number is the subject
box. If it does, then I would like it to create a new folder.

example 1. Incoming eMail

Item # 32112598 (as part the subject line)
I would like Outlook to create a folder called # 32112598, and put all further eMails from
whatever address or source into THIS folder.

example 2. Incoming eMail

Item # 44455533 (as part the subject line )
I would like Outlook to create a folder called # 44455533, and put all further eMails from
whatever address or source into THIS folder.

I have some VBA skills from programming Access but I have never go into the Outlook object Model and
I'm on unfamiliar territory, but you guys out there can save me wasting time

Thanks and Regards

Smiley Bob
 
Hello Smiley Bob,

Your project, certainly be created. I would be a little concerned about the
text in the subject.
If the subject always contained a static pattern: "Item # 32112598" things
would be quite simple.
I would suggest that you look closely at the subjects of some of your
existing ones, and determine
the difficulty of finding the Part Number. I am assuming that people will
people typing in the subject,
and people are not usually consistant, so it may take some constant tweaking
of your code to
pick up the subjects which actually contain a valid Item #.

That said, here is one way to do it:
This method would be for using a PST file, and a POP3 account.

1. Use will need to use Visual Basic 6.
2. You will be creating an "Outlook Add-In", which is a .dll program, there
is a wizard in VB6 for this.
3. You will catch all new emails, using the new email event (possibly
others).
4. Scan the subject for "Item # XXXXXXX, if found, check if folder exists,
if not make one, then move message.

If you are using an Exchange Mailbox, on either Exchange 5.5/2000/2003, then
the previous solution might not work.
As, I don't know what happens when you first open your mailbox, and you
instantly have 10 new messages.

Method #2:
1. Create an Event Sink on the Exchange Server itself, using CDOEX,
(Exchange 2000/2003 only).
2. Trap the onReceive Event, and do the same as procedure #1.

Unfortunately, I don't know of any existing code which will do what you
want, because you need
logic to scan the subject of the message. I don't think rules will not work,
because you can't make new
folders based on some variable.

Russell Mangel
Las Vegas, NV
 
Hello Smiley Bob,

Your project, certainly be created. I would be a little concerned about the
text in the subject.
If the subject always contained a static pattern: "Item # 32112598" things
would be quite simple.
I would suggest that you look closely at the subjects of some of your
existing ones, and determine
the difficulty of finding the Part Number. I am assuming that people will
people typing in the subject,
and people are not usually consistant, so it may take some constant tweaking
of your code to
pick up the subjects which actually contain a valid Item #.

That said, here is one way to do it:
This method would be for using a PST file, and a POP3 account.

1. Use will need to use Visual Basic 6.
2. You will be creating an "Outlook Add-In", which is a .dll program, there
is a wizard in VB6 for this.
3. You will catch all new emails, using the new email event (possibly
others).
4. Scan the subject for "Item # XXXXXXX, if found, check if folder exists,
if not make one, then move message.

If you are using an Exchange Mailbox, on either Exchange 5.5/2000/2003, then
the previous solution might not work.
As, I don't know what happens when you first open your mailbox, and you
instantly have 10 new messages.

Method #2:
1. Create an Event Sink on the Exchange Server itself, using CDOEX,
(Exchange 2000/2003 only).
2. Trap the onReceive Event, and do the same as procedure #1.

Unfortunately, I don't know of any existing code which will do what you
want, because you need
logic to scan the subject of the message. I don't think rules will not work,
because you can't make new
folders based on some variable.

Russell Mangel
Las Vegas, NV

Thank you Russell for your answer. My skills bank runs to vba and Ms Access programming. I have only
recently started looking deep into Ms Outlook 2000.

That said, I fired up my VB6 professional with SP5 and looked for the wizard in VB6 for "Outlook
Add-In, and could not see what you describe.

If you could confirm that it only exists in the Enterprise version, I will obtain that version
before I continue with this.

A slightly less ambitious version of my plan to download my emails in the normal way into the inbox
and then sort through my inbox by a right click on each incoming Mail item to say something along
the lines of:

If subject contains # XXXXXXXXXX then

move to outlook folder # XXXXXXXXXX

else if folder # XXXXXXXX does not exist "would you like to create it"

OK ( creates folder and moves it to the newly created folder).

I have seen the "MKDIR" command, which when I found it got me all exited, but that only made a
folder on my Hard Drive not within Ms Outllook 2000. So I am still back on the starting blocks with
this one.

Thanks for you help

Bob
 
Bob-

<< I...looked for the wizard in VB6 for "Outlook
Add-In", and could not see what you describe.
The option is called simply "Add-in", not "Outlook Add-
in". This is the same project type you use for any Office
add-in - you choose which app to target as part of the
Wizard that helps you set up the project.

Creating an Add-in is a picky enough process that you
should get some guidance; try
http://www.cdolive.com/prool2k.htm ,

http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/dnovba00/html/add-insdetail.asp ,

and http://msdn.microsoft.com/library/default.asp?
url=/library/en-us/office97/html/web/005.asp .

Good luck!

-Andrew
=======================================================
-----Original Message-----
Thank you Russell for your answer. My skills bank runs to
vba and Ms Access programming. I have only
recently started looking deep into Ms Outlook 2000.

That said, I fired up my VB6 professional with SP5 and
looked for the wizard in VB6 for "Outlook
Add-In, and could not see what you describe.

If you could confirm that it only exists in the
Enterprise version, I will obtain that version
before I continue with this.

A slightly less ambitious version of my plan to download
my emails in the normal way into the inbox
and then sort through my inbox by a right click on each
incoming Mail item to say something along
the lines of:

If subject contains # XXXXXXXXXX then

move to outlook folder # XXXXXXXXXX

else if folder # XXXXXXXX does not exist "would you like to create it"

OK ( creates folder and moves it to the newly created folder).

I have seen the "MKDIR" command, which when I found it
got me all exited, but that only made a
folder on my Hard Drive not within Ms Outllook 2000. So I
am still back on the starting blocks with
 
Back
Top