Private Sub AddContact(ByVal PhoneNumber As String)
Dim found As Boolean
Dim ol As OutlookSession = New OutlookSession()
Dim newContact As Contact
Dim iter As ContactCollection.ContactCollectionEnumerator =
ol.Contacts.Items.GetEnumerator()
Do While iter.MoveNext()
If (iter.Current.MobileTelephoneNumber.Equals(PhoneNumber)) Then
found = True
End If
Loop
If Not (found) Then
newContact = ol.Contacts.Items.AddNew()
'iter.Current.MobileTelephoneNumber = PhoneNumber
newContact.FirstName = "Joe"
newContact.MobileTelephoneNumber = PhoneNumber
newContact.Update()
End If
End Sub
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.