PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
vba script: add contact + distribution list
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook VBA Programming
vba script: add contact + distribution list
![]() |
vba script: add contact + distribution list |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
I've set up a rule so that when a certain subject is received then a message
pops up and that email is copied to a certain folder - simple enough and no mystery how to do that. Now I'd like to add a bit of VBA code such that when that rule is encountered the sender's email address is: 1. Added to the Contacts list 2. Put in a certain category 3. Added to a Distribution List I've had a search around the VBA documentation but don't see the objects (or recognize which objects) I need to use make this sort of thing happen. Is there a tutorial about this sort of thing on the web? Thanks. |
|
|
|
#2 |
|
Guest
Posts: n/a
|
ad 1)
For adding an item to the default contacts just call Application.CreateItem(olContactItem). If it isn´t the default contact list you need a reference to the folder and then call the MapiFolder.Items.Add method. You can walk through the hierarchie of folders (each folder has a folders collection) or use Sue´s sample "GetFolder" (http://www.outlookcode.com/d/code/getfolder.htm). ad 2) Both methods CreateItem and Items.Add returns the new object which has a category property. This is a semicolon separated list. Just append the new value (if need be separated by a semicolon). ad 3) First again you need a reference to the folder which stores the DL. With MapiFolder.Items.Item("yourDLName") you can get a reference to the DL if the name is unique. Otherwise you will need the EntryID or to loop through the folder. For the DistributionList.AddMembers method there is a good sample in the online help of OL VBA. -- Viele Grüße Michael Bauer "guy" <wildfiction@hotmail.com> wrote in message news:Os8SWdQxEHA.1988@TK2MSFTNGP12.phx.gbl... > I've set up a rule so that when a certain subject is received then a message > pops up and that email is copied to a certain folder - simple enough and no > mystery how to do that. > > Now I'd like to add a bit of VBA code such that when that rule is > encountered the sender's email address is: > 1. Added to the Contacts list > 2. Put in a certain category > 3. Added to a Distribution List > > I've had a search around the VBA documentation but don't see the objects (or > recognize which objects) I need to use make this sort of thing happen. Is > there a tutorial about this sort of thing on the web? > > Thanks. > > |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks Michael - that looks like just what I need. I will try that out
tomorrow when I have a moment on my hands. Thanks again. ![]() "Michael Bauer" <mib00@t-online.de> wrote in message news:ekcFJvWxEHA.1400@TK2MSFTNGP11.phx.gbl... > ad 1) > For adding an item to the default contacts just call > Application.CreateItem(olContactItem). > > If it isn´t the default contact list you need a reference to the folder > and then call the MapiFolder.Items.Add method. You can walk through the > hierarchie of folders (each folder has a folders collection) or use > Sue´s sample "GetFolder" > (http://www.outlookcode.com/d/code/getfolder.htm). > > ad 2) > Both methods CreateItem and Items.Add returns the new object which has a > category property. This is a semicolon separated list. Just append the > new value (if need be separated by a semicolon). > > ad 3) > First again you need a reference to the folder which stores the DL. With > MapiFolder.Items.Item("yourDLName") you can get a reference to the DL if > the name is unique. Otherwise you will need the EntryID or to loop > through the folder. > > For the DistributionList.AddMembers method there is a good sample in the > online help of OL VBA. > > > -- > Viele Grüße > Michael Bauer > > > "guy" <wildfiction@hotmail.com> wrote in message > news:Os8SWdQxEHA.1988@TK2MSFTNGP12.phx.gbl... >> I've set up a rule so that when a certain subject is received then a > message >> pops up and that email is copied to a certain folder - simple enough > and no >> mystery how to do that. >> >> Now I'd like to add a bit of VBA code such that when that rule is >> encountered the sender's email address is: >> 1. Added to the Contacts list >> 2. Put in a certain category >> 3. Added to a Distribution List >> >> I've had a search around the VBA documentation but don't see the > objects (or >> recognize which objects) I need to use make this sort of thing happen. > Is >> there a tutorial about this sort of thing on the web? >> >> Thanks. >> >> > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 


