PC Review


Reply
Thread Tools Rate Thread

vba script: add contact + distribution list

 
 
guy
Guest
Posts: n/a
 
      7th Nov 2004
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.


 
Reply With Quote
 
 
 
 
Michael Bauer
Guest
Posts: n/a
 
      8th Nov 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>


 
Reply With Quote
 
guy
Guest
Posts: n/a
 
      8th Nov 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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.
>>
>>

>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I add an existing contact to my existing Distribution List wihout having to open the Distribution List? Octavio Microsoft Outlook Contacts 9 9th Dec 2008 11:44 PM
Moving contact from distribution list to Contact folder William Microsoft Outlook Contacts 7 26th Dec 2007 10:09 PM
make a distribution list from a named category(in contact list) =?Utf-8?B?RGF2aWRh?= Microsoft Outlook 8 16th Apr 2006 09:12 AM
Create Distribution List from Contact List in Public Folders. =?Utf-8?B?REpS?= Microsoft Outlook Contacts 4 14th Jul 2005 05:56 PM
Create a distribution list from a category list in Business Contact Manager??? =?Utf-8?B?SVQgTmlnaHRtYXJl?= Microsoft Outlook Contacts 2 26th Jun 2004 08:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:21 PM.