A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Update the existing Contact item



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 8th 10, 05:54 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default Update the existing Contact item

Hi,

Could anyone please tell me how to update the Contact item? the following
code doesn't work. I want to update the fullname of existing contact item.
(all messageboxes prints the same existing fullname even after changing and
saving it)

Dim defaultContactsFolder As Outlook.MAPIFolder
Dim ocontactItem As Outlook.ContactItem
Dim ocontactItems, i
Set defaultContactsFolder =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderContacts)
Set ocontactItems = defaultContactsFolder.Items
MsgBox ocontactItems(1).FullName
ocontactItems(1).FullName = "testing"
MsgBox ocontactItems(1).FullName
ocontactItems(1).Save
MsgBox ocontactItems(1).FullName

Thanks.

Ads
  #2  
Old February 8th 10, 07:21 AM posted to microsoft.public.outlook.program_vba
paresh
external usenet poster
 
Posts: 66
Default Update the existing Contact item

Got it working. I need to set ContactItem object.

Dim defaultContactsFolder As Outlook.MAPIFolder
Dim ocontactItem As Outlook.ContactItem

Dim ocontactItems, i
Set defaultContactsFolder =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderContacts)
Set ocontactItems = defaultContactsFolder.Items
Set ocontactItem = ocontactItems(1)
MsgBox ocontactItem.FullName
ocontactItem.FullName = "testing"
MsgBox ocontactItem.FullName
ocontactItem.Save
MsgBox ocontactItems(1).FullName

Thanks.

"paresh" wrote:

Hi,

Could anyone please tell me how to update the Contact item? the following
code doesn't work. I want to update the fullname of existing contact item.
(all messageboxes prints the same existing fullname even after changing and
saving it)

Dim defaultContactsFolder As Outlook.MAPIFolder
Dim ocontactItem As Outlook.ContactItem
Dim ocontactItems, i
Set defaultContactsFolder =
Application.GetNamespace("MAPI").GetDefaultFolder( olFolderContacts)
Set ocontactItems = defaultContactsFolder.Items
MsgBox ocontactItems(1).FullName
ocontactItems(1).FullName = "testing"
MsgBox ocontactItems(1).FullName
ocontactItems(1).Save
MsgBox ocontactItems(1).FullName

Thanks.

 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Update Contact Item John Tripp Outlook and VBA 4 June 30th 09 03:44 PM
Update format of existing mobile phone numbers in outlook George Outlook - Using Contacts 1 January 28th 09 01:24 PM
How do I add and existing contact to an existing Distribution list? Octavio[_2_] Outlook - Using Contacts 3 January 24th 09 08:10 PM
"Cannot update the appointment because the corresponding item in the folder you syncronized does not match this item" Stephen Corliss Outlook - General Queries 1 June 26th 08 12:29 AM
How to Update Existing Items in an Outlook Folder to Use a New Cus mattia Outlook - Using Contacts 1 September 26th 06 09:28 PM


All times are GMT +1. The time now is 02:53 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2024 Outlook Banter.
The comments are property of their posters.