• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 186
  • Last Modified:

Updating and Deleting items from Outlook using Visual BAsic Code

I want to delete the contacts existing in Contact folder of MS Outlook by writing a code in Visual Basic
and also update and item in the contact folder.

I am able to delete if the item is exisiting in a user created folder using the below given code, but
I want it for the default folders

Set ol = New Outlook.Application
  Set olns = ol.GetNamespace("MAPI")
  Set TestFolder = olns.GetDefaultFolder(olFolderInbox).Folders("test")
  Set TestItems = TestFolder.Items
  NumItems = TestItems.Count
  For I = NumItems To 1 Step -1
     TestItems(I).Delete
  Next


Cn any one help
0
gondesiravi
Asked:
gondesiravi
1 Solution
 
rjcpjcCommented:
Not sure what you are asking.  If you want to reference the default contact folder use the following line.

Set TestFolder = olns.GetDefaultFolder(olFolderContacts)
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now