A
Alex
In my add-In when i try to find a contact e-mail, with the function
below:
Private Function getMailByName(ByVal Name As String) As String
Dim outlookObject As Outlook._Application = New
Outlook.Application
Dim folder As Outlook.MAPIFolder =
outlookObject.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
Dim mailAddress As String = String.Empty
Try
For Each contact As Outlook.ContactItem In folder.Items
If contact.FileAs.Contains(Name) Then
mailAddress = contact.Email1Address
Exit For
End If
Next
Catch ex As Exception
Debug.WriteLine(ex.Message)
Finally
If outlookObject IsNot Nothing Then outlookObject = Nothing
If folder IsNot Nothing Then folder = Nothing
End Try
Return mailAddress
End Function
I get this alert message:
"A program is trying to access e-mail address information stored in
outlook. If this is unexpected ... "
There is any way to programmatically allow the access to contact
folder.
below:
Private Function getMailByName(ByVal Name As String) As String
Dim outlookObject As Outlook._Application = New
Outlook.Application
Dim folder As Outlook.MAPIFolder =
outlookObject.ActiveExplorer().Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
Dim mailAddress As String = String.Empty
Try
For Each contact As Outlook.ContactItem In folder.Items
If contact.FileAs.Contains(Name) Then
mailAddress = contact.Email1Address
Exit For
End If
Next
Catch ex As Exception
Debug.WriteLine(ex.Message)
Finally
If outlookObject IsNot Nothing Then outlookObject = Nothing
If folder IsNot Nothing Then folder = Nothing
End Try
Return mailAddress
End Function
I get this alert message:
"A program is trying to access e-mail address information stored in
outlook. If this is unexpected ... "
There is any way to programmatically allow the access to contact
folder.