none
session.CurrentUser takes 60 seconds even after MAPILogonComplete RRS feed

  • Question

  • Hi,

    I'm having problems with the load time of an Outlook AddIn in Outlook 2013.

    Per Slovak's recommendation, I've moved all my initialization code into 

    application.MAPILogonComplete (I'm implementing IDTExtensibility2 in C#, not using VSTO).

    However, when I call session.CurrentUser, the call takes at least 60 seconds to complete.  Is there some later event I an hook into to ensure that session.CurrentUser won't hang? 

    I suspect this has to do with an Exchange account.

    Thanks,

    Greg

    application.MAPILogonComplete

    Tuesday, March 5, 2013 7:33 PM

Answers

  • Hi Greg,
     
    I'd try 2 things.
     
    First, try handling SyncObjects[1].SyncEnd() and see if that fires for you at a point where you can retrieve that object.
     
    Second, a timer could be started in MAPILogonComplete() that you use to initiate actions such as reading CurrentUser. Obviously you need to make sure the timer is running in the addin thread or is synched to that thread, a Windows Forms timer on a hidden form created during OnConnection() or OnStartupComplete() would do it.
     
    I've been doing that in my addins lately to account for 2013 startup timing issues.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "gregthatcher" <=?utf-8?B?Z3JlZ3RoYXRjaGVy?=> wrote in message news:a5637244-b65e-4ca5-b117-92d3d16f710c...

    It looks like calling Session.CurrentUser when you don't currently have an Exchange connection takes about 60 seconds to return.  Is there some kind of work-around for this?  Is there some way to get the current user's info with a different call that doesn't cause a long delay?

    Note that this problem only happens on Outlook 2013; the call always returns quickly (regardless of whether or not its an Exchange account) on Outlook 2010 and Outlook 2007.


    Ken Slovak MVP - Outlook
    Wednesday, March 6, 2013 3:43 PM
    Moderator
  • Not that I know of, but I haven't really tested for such a long delay before the object is valid. Can you use RDO? If so does it return quicker with that information?
     
    I'd think the most responsive would be if you could handle SyncEnd() on that initial send/receive synch.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "gregthatcher" <=?utf-8?B?Z3JlZ3RoYXRjaGVy?=> wrote in message news:dd4665e4-c4e5-47eb-83f9-9bf101620166...
    I really just need the AddressEntry of the main email account.  Is there an faster way (faster than the 60 seconds Session.CurrentUser is taking) to get this on startup besides using Session.CurrentUser.AddressEntry?

    Ken Slovak MVP - Outlook
    Wednesday, March 6, 2013 8:13 PM
    Moderator

All replies

  • Does it take just as long if you call CurrentUser later?

    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 5, 2013 7:37 PM
  • If I call it after all the Outlook UI (main Explorer window) has completely loaded, it returns instantly.

    Thanks very much for responding so fast.

    Greg

    Tuesday, March 5, 2013 8:03 PM
  • It looks like calling Session.CurrentUser when you don't currently have an Exchange connection takes about 60 seconds to return.  Is there some kind of work-around for this?  Is there some way to get the current user's info with a different call that doesn't cause a long delay?

    Note that this problem only happens on Outlook 2013; the call always returns quickly (regardless of whether or not its an Exchange account) on Outlook 2010 and Outlook 2007.

    Wednesday, March 6, 2013 12:49 AM
  • what information in particular you are trying to obtain?
    Wednesday, March 6, 2013 8:20 AM
  • Hi Greg,
     
    I'd try 2 things.
     
    First, try handling SyncObjects[1].SyncEnd() and see if that fires for you at a point where you can retrieve that object.
     
    Second, a timer could be started in MAPILogonComplete() that you use to initiate actions such as reading CurrentUser. Obviously you need to make sure the timer is running in the addin thread or is synched to that thread, a Windows Forms timer on a hidden form created during OnConnection() or OnStartupComplete() would do it.
     
    I've been doing that in my addins lately to account for 2013 startup timing issues.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "gregthatcher" <=?utf-8?B?Z3JlZ3RoYXRjaGVy?=> wrote in message news:a5637244-b65e-4ca5-b117-92d3d16f710c...

    It looks like calling Session.CurrentUser when you don't currently have an Exchange connection takes about 60 seconds to return.  Is there some kind of work-around for this?  Is there some way to get the current user's info with a different call that doesn't cause a long delay?

    Note that this problem only happens on Outlook 2013; the call always returns quickly (regardless of whether or not its an Exchange account) on Outlook 2010 and Outlook 2007.


    Ken Slovak MVP - Outlook
    Wednesday, March 6, 2013 3:43 PM
    Moderator
  • I really just need the AddressEntry of the main email account.  Is there an faster way (faster than the 60 seconds Session.CurrentUser is taking) to get this on startup besides using Session.CurrentUser.AddressEntry?
    Wednesday, March 6, 2013 7:19 PM
  • Not that I know of, but I haven't really tested for such a long delay before the object is valid. Can you use RDO? If so does it return quicker with that information?
     
    I'd think the most responsive would be if you could handle SyncEnd() on that initial send/receive synch.

    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "gregthatcher" <=?utf-8?B?Z3JlZ3RoYXRjaGVy?=> wrote in message news:dd4665e4-c4e5-47eb-83f9-9bf101620166...
    I really just need the AddressEntry of the main email account.  Is there an faster way (faster than the 60 seconds Session.CurrentUser is taking) to get this on startup besides using Session.CurrentUser.AddressEntry?

    Ken Slovak MVP - Outlook
    Wednesday, March 6, 2013 8:13 PM
    Moderator