none
How to access Outlook auto-complete stream (in memory, not the cache version) RRS feed

  • Question

  • Hi,

    I have built an Outlook addin and am trying to work with the contents of the Outlook (2010/13) autocomplete stream but have hit a road block trying to access the in-memory version of it.  I am currently able to retrieve the stored nickname cache / autocomplete stream that resides in by:

    Dim olApp As Outlook.Application = Application
    Dim olNS As Outlook.NameSpace = olApp.GetNamespace("MAPI")
    Dim inboxFolder As Outlook.MAPIFolder = olNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
    Dim storage As Outlook.StorageItem = inboxFolder.GetStorage("IPM.Configuration.Autocomplete", Outlook.OlStorageIdentifierType.olIdentifyByMessageClass)
    Dim propertyAcc As Outlook.PropertyAccessor = storage.PropertyAccessor
    Dim bytes() As Byte = propertyAcc.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x7C090102")


    This returns the byte array which I can then loop through to get the information I require.  However, this only updates when Outlook closes and so doesn't contain any recent additions that might have occurred during the current Outlook session.  I know Outlook keeps a cache of this autocomplete stream in memory which it uses throughout the current session, updating it when new recipients are sent to / contacts added...etc.  How do I access this?

    I've managed to find the following property:

    Const PidTagRoamingBinary As String = "http://schemas.microsoft.com/mapi/proptag/0x7C09000A"

    But am not sure what to use it with, trying with the current message object gives an error and I can't find that much info / examples online about it...

    Some links that I have found:

    Programmatically Accessing the Nickname Cache in Outlook 2010

    Nickname Cache

    PidTagRoamingBinary Canonical PropertyWould really appreciate any help from anyone who knows about how I can do this!

    Thanks a lot!

    Tom


    • Edited by moatak787 Thursday, February 26, 2015 11:08 AM
    Thursday, February 26, 2015 11:06 AM

All replies

  • Hello Tom,

    I don't think it is possible and there is a supported way to get such information at runtime. You have already found a  way to read the auto-complete cache.

    Thursday, February 26, 2015 12:23 PM
  • Hi Eugene,

    Thanks for your answer.  Assuming this is the case, I guess I would have to create my own 'assumed' auto-complete cache while Outlook is open, based on the similar conditions that a new entry might have been added (I am more concerned about missing these, than entries the user might have deleted from the list).

    In the link Programmatically Accessing the Nickname Cache in Outlook 2010, it mentions some ways in which the stream might be modified and I was planning on capturing these events to update my own cache.  The only parameters I care about are:

    - PR_NICK_NAME_W -> 0x6001001F
    - PR_SMTP_ADDRESS_W -> 0x39FE001F or PR_EMAIL_ADDRESS_W -> 0x3003001F
    - PR_DISPLAY_NAME_W -> 0x3001001F
    - PR_NICK_NAME_WEIGHT -> 0x60040003

    I know I can't necessarily update the weight, but the others I was hoping to keep updated in the following way:

    1) On outlook open create new own cache based on stored auto-complete cache

    2) If user sends an email to a new recipient not on this cache, add this recipient to my cache (use SMTP_Address or Email_Address as display name (whichever has @ symbol in it - this accounts for exchange users)

    3) If user adds a new contact, add this contact to my cache (whichever details are available)

    What I want to check is exactly when new entries are made to the actual cache to make sure I've covered everything. My understanding is that by default Outlook 2010/13 has a maximum of 1000 contacts for the cache, and if it reaches this limit the the weight plays a part as to whether they are included or not.  What happens if the user has more than 1000 contacts, will the same still apply in that the top 1000 are chosen based on weighting? Or do all the contacts still show because these are shown as suggestions via a different process, not the auto-complete cache?

    Thanks again,

    Tom

    Thursday, February 26, 2015 1:56 PM
  • 0x7C09000A is wrong - the type is PT_ERROR = 0x000A.

    Did you mean 0x7C090102 (PT_BINARY = 0x0102)?


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

    Thursday, February 26, 2015 5:04 PM
  • Hi Dmitry,

    Yes the 0x7C090102 is what I am currently using to get the IPM.Configuration.Autocomplete, however I found that other one on a website and thought it might have been for something different, maybe the in-memory version... but it seems there is no way of access the in-memory cache.

    Thursday, February 26, 2015 6:29 PM
  • No, there is no way to do that. But if you modify that stream, Outlook will detect a change and load it.

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

    Thursday, February 26, 2015 8:40 PM
  • Hi Dmitry,

    Just to clarify, when you say modify the stream are you talking about the in-memory stream that Outlook uses to keep track of the auto-suggestions, which it then writes back to the 0x7C090102 property on Outlook close / restart?  I didn't think Outlook loads this change to 0x7C090102 until Outlook restart.

    I am only wanting to read the in-memory stream (not write) since my app requires to know which auto-suggestions could be offered to the user at any point in time. However this seems impossible for users who leave Outlook running (without closing) for days, and therefore don't allow it to refresh the 0x7C090102 property which I read from - new emails addresses might be added to the cache when they send to recipients...etc, and I won't be able to see this until they restart Outlook.

    My hack was to create my own list, based off the 0x7C090102 on Outlook open event, and then try and keep this roughly updated for new contacts / recipients while Outlook is running.  Each time Outlook is restarted, I start fresh with the latest data from 0x7C090102.

    Does that make sense, or is there a better way?

    Thanks a lot!

    Tom

    Friday, February 27, 2015 9:12 AM