Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Contacts / August 2006

Tip: Looking for answers? Try searching our database.

Editing contacts in a Public Folder from within Excel VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mogge - 27 Aug 2006 11:02 GMT
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
nnnnnnn@e-mail2sms.xx 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
Sue Mosher [MVP-Outlook] - 28 Aug 2006 20:21 GMT
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


Signature

Sue Mosher, Outlook MVP
  Author of Configuring Microsoft Outlook 2003
    http://www.turtleflock.com/olconfig/index.htm
  and Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx
 

> Hi
>
[quoted text clipped - 20 lines]
> Kind Regards
> Mogge
Mogge - 28 Aug 2006 21:02 GMT
Thanks, Sue...

I will check it out.

/Mogge

> Like Excel, Outlook has a rich object model with Help topics describing each property and method. The ones you'll need are:
>
[quoted text clipped - 43 lines]
> > Kind Regards
> > Mogge
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.