Editing contacts in a Public Folder from within Excel VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I'm currently creating a lot of scripts that can read or manipulate the AD
informations on users and need right now a way to edit, create or delete
contacts created in a Public Folder. The idéa is to make a copy of the users
created in the AD with a special email addr. and to keep them updated all the
time. The reason is that we use a special e-mail to sms service that allow us
to send a sms to an employee cell phone if we use the syntax
(e-mail address removed) where n = number to cell.

I need a way to manipulate a contact from within Excel VBA (i have some
other code i the same script that read the same information in order to
create a paper form telephone list).

The three things I need to be able to is:

* Create a contact
* Delete a contact
* Edit a contact

Can anyone help me, please?

Kind Regards
Mogge
 
Like Excel, Outlook has a rich object model with Help topics describing each property and method. The ones you'll need are:
* Create a contact

To create a new item in a non-default folder programmatically, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class parameter is optional.

To create an item in another person's mailbox, use Namespace.GetSharedDefaultFolder to get the target MAPIFolder. Otherwise, you can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.
* Delete a contact
ContactItem.Delete

* Edit a contact

ContactItem.property = Value
ContactItem.Save

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Thanks, Sue...

I will check it out.

/Mogge


Sue Mosher said:
Like Excel, Outlook has a rich object model with Help topics describing each property and method. The ones you'll need are:


To create a new item in a non-default folder programmatically, use the Add method on the target folder's Items collection:

Set newItem = targetFolder.Items.Add("IPM.Post.YourFormName")

The message class parameter is optional.

To create an item in another person's mailbox, use Namespace.GetSharedDefaultFolder to get the target MAPIFolder. Otherwise, you can use the code at http://www.outlookcode.com/d/code/getfolder.htm to walk the folder hierarchy and return the MAPIFolder corresponding to a given path string.


ContactItem.property = Value
ContactItem.Save

FYI, there is a newsgroup specifically for general Outlook programming issues "down the hall" at microsoft.public.outlook.program_vba or, via web interface, at http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.outlook.program_vba

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top