-2147467259 Automation error with redemption

May 20, 2009
Reaction score

If anybody could help me on the particular error, when trying to access the address list of a user from EXCHANGE SERVER 2010, with REDEMPTION. The issue the first set of code, provided below only returns a certain amount of data and errors out for a mail address, the second time the code is executed that particular mail address,gets retrieved and displayed without any error and errors out for another mail address. The piece of code that errors out is as below, and the exact statement where the error occurs has been bolded,

Private Sub DisplayExchangeUserData(iopt As Integer)
Dim AEnty As MAPI.AddressEntry
Dim AEntrs As MAPI.AddressEntries
Dim i As Integer
Dim sInfo As String
Dim str As String
Const CdoPR_EMS_AB_HOME_MTA = &H8007001E

Screen.MousePointer = vbHourglass
str = "/cn=Configuration/cn=Servers/cn="

If iopt = 0 Then 'ALL Users
Set AEntrs = moSession.AddressLists("All Users").AddressEntries
Set AEntrs = moSession.AddressLists("Global Address List").AddressEntries
End If

For Each AEnty In AEntrs

If AEnty.DisplayType = CdoDisplayType.CdoUser Or _
AEnty.DisplayType = CdoDisplayType.CdoRemoteUser Then
On Error GoTo ErrorHandler
sInfo = AEnty.Fields(CdoPR_EMS_AB_HOME_MTA)
WriteToLogFile (AEnty.Fields(CdoPR_ACCOUNT) & " - " & sInfo)
End If

Next AEnty
Screen.MousePointer = vbNormal
Exit Sub
WriteToLogFile (AEnty.Name & "Error : " & Err.Number & " - " & Err.Description)
GoTo WriteServerInfo
End Sub

Whereas the below code works fine...

Private Sub DisplayExchangeUserData(iopt As Integer)
Dim Table As Redemption.MAPITable
Const CdoPR_EMS_AB_HOME_MTA = &H8007001E
Dim Columns(2)
Dim Row

On Error GoTo ErrorHandler1

Const CdoPR_EMS_AB_HOME_MTA = &H8007001E
Screen.MousePointer = vbHourglass
Set Table = CreateObject("Redemption.MAPITable")

If iopt = 0 Then 'ALL Users
Table.Item = roSession.AddressBook.AddressLists.Item("All Users").AddressEntries
Table.Item = roSession.AddressBook.AddressLists.Item("Global Address List").AddressEntries
End If

Columns(0) = CdoPR_ACCOUNT
Columns(1) = CdoPR_EMS_AB_HOME_MTA
Columns(2) = CdoPR_DISPLAY_TYPE

Table.Columns = Columns

WriteToLogFile (Now & "MAPITable Method")
Do While Not IsEmpty(Row)
If ((Row(2)) = 0 Or Row(2) = 6) Then
WriteToLogFile (CStr(Row(0)) & " - " & CStr(Row(1)))
End If
WriteToLogFile (Now & " MAPITable Method Complete" & vbCrLf & vbCrLf)
End Sub

Please advice whether there are any setting in Exchange Server 2010, that could be limiting the number of records being retrieved, or is this a know issue, where the MAPI.AddressEntries has to be replaced with MAPITABLES.

Thanks in advance for the help extended.

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.

Ask a Question