none
Long response time for ExchangeUser properties RRS feed

  • Question

  • Hi

    During the last days (or weeks?) something bad started happening when I'm using ExchangeUser to get some properties - it can take a VERY long time; sometimes 20+ seconds.

    I'm using the ExchangeUser to get the name and the Primary SMTP Address of the user, and later I'm using PropertyAccessor to grab the list of all email address list. (I'll add code later, once I be near my machine).
    This code runs for more than 2 years, and till now it worked fine and fast (took few milliseconds per AddressEntry).
    Something has changed in the last weeks, and I can't tell what.
    Many users complained about it.

    Has anyone else noticed such problem?
    Any idea what may cause it?

    Thanks!
    Moshe

    Tuesday, March 19, 2013 3:46 PM

Answers

All replies

  • Remember that GAL entries are stored in the Active Directory, so something might have changed in AD.

    Do you see that problem on all machines where your code runs or only on one?


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, March 19, 2013 4:23 PM
  • The problem happens on many machines, though not on all.
    I think I see it more on OL2010 than on OL2007, yet I need to continue collect information (but it does happen also with OL2007).

    Also - it happens in at least two different customer organizations.

    Tuesday, March 19, 2013 4:39 PM
  • What is the relevant snippet of your code?

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, March 19, 2013 4:43 PM
  • It's something like this [VB6] (real code is c#, not at my hand now):

    Private Sub Command1_Click() On Error GoTo e AddLog "-------------------------------------------" Dim rcpt As Outlook.Recipient Dim sErr As String Dim rd As RcptData Set rd = New RcptData Set rcpt = oNS.CreateRecipient(txtRcpt.Text) AddLog "Resolving recipient... " rcpt.Resolve AddLog "recipient resolved completed" If (rcpt.Resolved) Then Dim oAE As Outlook.AddressEntry Set oAE = rcpt.AddressEntry If (oAE Is Nothing) Then sErr = "Address Entry is empty!" GoTo p End If AddLog "Got Address Entry" Dim oAEType As OlAddressEntryUserType oAEType = oAE.AddressEntryUserType AddLog "Address Entry Type = " & oAEType Select Case oAEType Case OlAddressEntryUserType.olSmtpAddressEntry: rd.FirstName = oAE.Name rd.PrimaryEmail = oAE.Address Case OlAddressEntryUserType.olExchangeUserAddressEntry, OlAddressEntryUserType.olExchangeRemoteUserAddressEntry: Dim oEXUser As Outlook.ExchangeUser AddLog "Getting Exchange User..." Set oEXUser = oAE.GetExchangeUser AddLog "Got Exchange User" If (oEXUser Is Nothing) Then sErr = "Exchange User is empty!" GoTo p End If AddLog "Gettign data from Exchange User..."

    '*********************************************************************
    'This takes too long time
    rd.FirstName = oEXUser.FirstName rd.LastName = oEXUser.LastName rd.PrimaryEmail = oEXUser.PrimarySmtpAddress

    '********************************************************************* AddLog "Got data from Exchange User..." Set oEXUser = Nothing Case OlAddressEntryUserType.olOutlookContactAddressEntry: Dim cnt As Outlook.ContactItem Set cnt = oAE.GetContact If (cnt Is Nothing) Then sErr = "Contatc User is empty!" GoTo p End If AddLog "Gettign data from Contact User..." rd.FirstName = cnt.FirstName rd.LastName = cnt.LastName rd.PrimaryEmail = cnt.Email1Address AddLog "Got data from Contact User" Set cnt = Nothing Case Else End Select Call rd.SetAllEmail(GetAllEmails(oAE)) Else MsgBox "Cannot Resolve recipient: " & txtRcpt.Text AddLog "Cannot Resolve recipient: " & txtRcpt.Text End If Set oAE = Nothing Set rcpt = Nothing Exit Sub p: AddLog sErr MsgBox sErr Exit Sub e: sErr = "ERROR: " & Err.Description MsgBox sErr AddLog sErr End Sub Private Function GetAllEmails(oAE As AddressEntry) As String() Dim oPA As PropertyAccessor Set oPA = oAE.PropertyAccessor Dim sAddresses() As String AddLog "Getting " & "http://schemas.microsoft.com/mapi/proptag/" & "0x800F101E" & "..."

    '*********************************************************************
    'This takes too long time
    sAddresses = oPA.GetProperty("http://schemas.microsoft.com/mapi/proptag/" & "0x800F101E") '********************************************************************* AddLog "Got property" GetAllEmails = sAddresses Set oPA = Nothing End Function




    Tuesday, March 19, 2013 4:56 PM
  • As an experiment, can you try to download Redemption and run the following script either Outlook VBA or the Script window in OutlookSpy?

    If it is also slow, I can send you a debug version of Redemption that should be able to pinpoint which MAPI call is causing the problem.

    strNameToResolve = "<some name>"
    set Session = CreateObject("Redemption.RDOSession")
    Session.MAPIOBJECT = Application.Session.MAPIOBJECT
    set AE = Session.AddressBook.ResolveName(strNameToResolve)
    MsgBox AE.FirstName & " " & AE.Lastname & ": " & AE.SmtpAddress


    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    Tuesday, March 19, 2013 6:08 PM
  • Sure, thank you!
    I'll post the results tomorrow.
    Tuesday, March 19, 2013 6:16 PM
  • An update (apologize for the long time):

    I found that the issue was working with non-cache mode.
    I assume it quite reasonable, but it means that for users that I provide poor performance for users who choose to work in this mode.

    Maybe someone has an idea how to improve it?
    Thanks!

    Tuesday, April 9, 2013 11:16 AM
  • I don't think there is anything you can do - non-cached mode is inherently slower...

    Dmitry Streblechenko (MVP)
    http://www.dimastr.com/redemption
    Redemption - what the Outlook
    Object Model should have been
    Version 5.4 is now available!

    • Marked as answer by Moshe_Malin Thursday, April 11, 2013 10:07 AM
    Tuesday, April 9, 2013 5:13 PM