Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Outlook Operation Fails when trying to access the Exchange Global Address List

184 views
Skip to first unread message

Fred Ferguson

unread,
May 9, 2012, 3:34:18 PM5/9/12
to
My organization recently upgraded our Exchange server from Exchange 2003 to 2010. Since the upgrade some users are experiencing issues connecting to the new exchange server Global Address list from a custom VB.NET windows application using the Microsoft.Office.Interop.Outlook 12.0 Libraray. The Application was developed with VS 2008 and deployed via ClickOnce with Prerequisite Office Runtime 3.0 SP1. When the applicatoin attempts to access the exchange global address list, a pop-up message from outlook displays: "Outlook is trying to retrieve data from Myserver.Domain", and shortly after the app give an exception "Outlook Operation Failed". All users are on Outlook 2007. Below is the VB code used. I'm not sure if the issue is with the code, version of the Interop Library, or a setting on the users computer or exchange server. (Outlook Trust Center setting are all set properly)

PLEASE HELP! pretty stuck at this point.

VB Code.
----------------------------------
Dim olA As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application
Dim Ns As Microsoft.Office.Interop.Outlook.NameSpace = olA.GetNamespace("MAPI")
Dim AddressEntry As Microsoft.Office.Interop.Outlook.AddressEntry = Nothing
Dim olAddressList As Microsoft.Office.Interop.Outlook.AddressList = Ns.GetGlobalAddressList
Dim objExuser As Microsoft.Office.Interop.Outlook.ExchangeUser = Nothing
Dim Address As String = ""
Dim strName As String = ""

Dim AddressArray() As String = Nothing
m_strProc = "ModCombos.ExchangeEmail"

Try
m_dt = New DataTable
m_dt.Columns.Add("ExUser_Name", GetType(String))
m_dt.Columns.Add("Smtp_Address", GetType(String))

For Each Entry In olAddressList.AddressEntries
Dim objExGroup As Microsoft.Office.Interop.Outlook.ExchangeDistributionList = Nothing
objExuser = Nothing
AddressEntry = Entry
strName = AddressEntry.Name
objExuser = AddressEntry.GetExchangeUser

If objExuser Is Nothing Then objExGroup = AddressEntry.GetExchangeDistributionList

If Not objExuser Is Nothing Then
Address = objExuser.PrimarySmtpAddress.ToString
m_dt.Rows.Add(strName, LCase(Address))
ElseIf Not objExGroup Is Nothing Then
Address = objExGroup.PrimarySmtpAddress.ToString
m_dt.Rows.Add(strName, LCase(Address))
ElseIf AddressEntry.Address.Contains("/") Then
AddressArray = Split(AddressEntry.Address, "/")
Address = AddressArray(4).ToString
Address = LCase(Mid(Address, InStr(Address, "=") + 1, Len(Address)))
If Not UCase(Right(Address, 7)) = "MyCompany.ORG" Then Address = Address & "@Mycompany.org"
m_dt.Rows.Add(strName, Trim(Address))
ElseIf UCase(Right(AddressEntry.Address, 7)) = "MyCompany.ORG" Then
Address = Trim(AddressEntry.Address)
m_dt.Rows.Add(strName, LCase(Address))
End If
Next

ExchangeDt = m_dt


m_dt = Nothing
olA = Nothing
Ns = Nothing
olAddressList = Nothing
objExuser = Nothing
AddressEntry = Nothing

Return ExchangeDt


Catch ex As Exception
MsgBox(ex.Source & vbCrLf & ex.Message, MsgBoxStyle.Critical, "ERROR: " & m_strProc)
Err.Clear()

m_dt = Nothing
olA = Nothing
Ns = Nothing
olAddressList = Nothing
objExuser = Nothing
AddressEntry = Nothing

Return Nothing

End Try

End Function


Marshal Hubs

unread,
May 9, 2012, 11:46:02 PM5/9/12
to
Hi,
I think code is correct but there are some setting problem b/w Outlook and exchange, i have found a link troubleshoot this error from outlook 2002 and 2003. http://support.microsoft.com/kb/892764, Hope so it works with Outlook 2007


Fred Ferguson

unread,
May 10, 2012, 8:59:33 AM5/10/12
to
Thanks for your post Marshal. I will check it out and let you know if it worked or not.


Marshal Hubs

unread,
May 11, 2012, 2:09:01 AM5/11/12
to
Hi Fred,
Sure, I am waiting ! According to my experience it will help.


0 new messages