B
Ben Crinion
Hi
I recently adjusted my code to use redemption rather than CDO to avoid
making users of my software intstall CDO but now im getting security
warnings from Outlook.
Here is the line which causes the warning.
Set objAddressEntries =
Application.Session.AddressLists.Item(3).AddressEntries
If I click no to not allow my program access to the Address Book it still
manages to get access and perform as expected but I dont want users to have
to click every time my app calls this function.
Am i using redemption correctly as i read somewhere that im not supposed to
dim objects as redemption.whatever as type mismatch errors occur? I just
dont understand.
Does anyone have any clues?
Thanks
Ben Crinion
Here is the full code of the fuction.
Public Function SearchGlobalAddressList_NONCDO(ByVal strPhoneNo As String)
As String
'table dims
MsgBox "Dims"
Dim Columns(1)
Dim Row
Dim Filter 'As Redemption.TableFilter
Dim Restr 'As Redemption.RestrictionProperty
Dim Table 'As Redemption.MAPITable
'address dims
'Dim objSession 'As session
Dim objAddressLists 'As Redemption.AddressLists
Dim objAddressList 'As Redemption.AddressList
Dim objAddressEntries As Redemption.AddressEntries
'Get Global Address List
'Set objAddressList = objSession.getaddresslist(CdoAddressListGAL)
MsgBox "set address lists"
Set objAddressLists = Application.Session.AddressLists
Debug.Print objAddressLists.Item(3).Name
MsgBox "set address list"
Set objAddressList = objAddressLists.Item(3)
'Obtain the entire list of contacts and distribution lists in the
address book.
MsgBox "set address entries"
'Set objAddressEntries = objAddressList.AddressEntries
..
'Here is the line which causes the warning.
Set objAddressEntries =
Application.Session.AddressLists.Item(3).AddressEntries
MsgBox "tickle"
'hex values for the fields i need
PR_DISPLAY_NAME = &H3001001E
PR_MOBILE_PHONE_NO = &H3A1C001E
'set the contents of the table to the the collection of address entries
MsgBox "create table"
Set Table = CreateObject("TBOLcom.MAPITable")
MsgBox "add entries to table"
Table.Item = objAddressEntries
MsgBox "1"
Columns(0) = PR_DISPLAY_NAME
Columns(1) = PR_MOBILE_PHONE_NO
MsgBox "2"
Table.Columns = Columns
Table.GoToFirst
Dim temp As String
Do
MsgBox "get row"
Row = Table.GetRow
If Not IsEmpty(Row) Then
On Error Resume Next
MsgBox "access table"
temp = StripNumber(Row(1))
If temp = strPhoneNo Then
MsgBox "return table data as string"
SearchGlobalAddressList_NONCDO = ("(" & Row(0) & ") " &
Row(1))
boolFoundContact = True
Exit Function
End If
End If
Loop Until IsEmpty(Row)
SearchGlobalAddressList_NONCDO = "-1"
End Function
I recently adjusted my code to use redemption rather than CDO to avoid
making users of my software intstall CDO but now im getting security
warnings from Outlook.
Here is the line which causes the warning.
Set objAddressEntries =
Application.Session.AddressLists.Item(3).AddressEntries
If I click no to not allow my program access to the Address Book it still
manages to get access and perform as expected but I dont want users to have
to click every time my app calls this function.
Am i using redemption correctly as i read somewhere that im not supposed to
dim objects as redemption.whatever as type mismatch errors occur? I just
dont understand.
Does anyone have any clues?
Thanks
Ben Crinion
Here is the full code of the fuction.
Public Function SearchGlobalAddressList_NONCDO(ByVal strPhoneNo As String)
As String
'table dims
MsgBox "Dims"
Dim Columns(1)
Dim Row
Dim Filter 'As Redemption.TableFilter
Dim Restr 'As Redemption.RestrictionProperty
Dim Table 'As Redemption.MAPITable
'address dims
'Dim objSession 'As session
Dim objAddressLists 'As Redemption.AddressLists
Dim objAddressList 'As Redemption.AddressList
Dim objAddressEntries As Redemption.AddressEntries
'Get Global Address List
'Set objAddressList = objSession.getaddresslist(CdoAddressListGAL)
MsgBox "set address lists"
Set objAddressLists = Application.Session.AddressLists
Debug.Print objAddressLists.Item(3).Name
MsgBox "set address list"
Set objAddressList = objAddressLists.Item(3)
'Obtain the entire list of contacts and distribution lists in the
address book.
MsgBox "set address entries"
'Set objAddressEntries = objAddressList.AddressEntries
..
'Here is the line which causes the warning.
Set objAddressEntries =
Application.Session.AddressLists.Item(3).AddressEntries
MsgBox "tickle"
'hex values for the fields i need
PR_DISPLAY_NAME = &H3001001E
PR_MOBILE_PHONE_NO = &H3A1C001E
'set the contents of the table to the the collection of address entries
MsgBox "create table"
Set Table = CreateObject("TBOLcom.MAPITable")
MsgBox "add entries to table"
Table.Item = objAddressEntries
MsgBox "1"
Columns(0) = PR_DISPLAY_NAME
Columns(1) = PR_MOBILE_PHONE_NO
MsgBox "2"
Table.Columns = Columns
Table.GoToFirst
Dim temp As String
Do
MsgBox "get row"
Row = Table.GetRow
If Not IsEmpty(Row) Then
On Error Resume Next
MsgBox "access table"
temp = StripNumber(Row(1))
If temp = strPhoneNo Then
MsgBox "return table data as string"
SearchGlobalAddressList_NONCDO = ("(" & Row(0) & ") " &
Row(1))
boolFoundContact = True
Exit Function
End If
End If
Loop Until IsEmpty(Row)
SearchGlobalAddressList_NONCDO = "-1"
End Function