About MAPI URLs for Notification-Based Indexing

About MAPI URLs for Notification-Based Indexing

When a store provider notifies an indexer that an object is ready for indexing, it generates a MAPI Uniform Resource Locator (URL) that uniquely identifies the object to the MAPI Protocol Handler. MAPI URLs are encoded in Unicode, and have the following format:

  Mapi://SID/StoreDisplayName ($HashNumber)/StoreType/FolderNameA/…/FolderNameN/[EntryIDEncoded[/at=AttachIDEncoded:FileName]]

The various parts of the typical URL are described below.

SID

Current user’s security identifier.

StoreDisplayName

A string that specifies the display name of the user on that store.

HashNumber

A DWORD in hexadecimal representation that is calculated based on the store entry ID or the store mapping signature. This value is stored in the registry and will be used later to identify the store in the MAPI Protocol Handler. This number must be calculated in a way that minimizes collisions with other stores. For the algorithm that Microsoft Office Outlook uses to calculate the hash number, see Algorithm to Calculate the Store Hash Number.

StoreType

A number that identifies the type of the store that contains the object to be indexed. The possible values are:

0 – Default store.

1 – Delegate store, used for delegate items cached locally.

2 – Public folders, used for public folder favorites.

Note that if the store is being crawled instead of pushed, the value used is none of the above, but instead it will be the character X.

FolderNameA/…/FolderNameN

The path from the root of the IPM_SUBTREE to the folder or message. For example, a message in the Family folder under Inbox has Inbox/Family for this parameter.

EntryIDEncoded

MAPI entry ID for the item encoded as a Unicode string. See the section "Special Characters" for information on how certain special characters get encoded. For more information about the algorithm to encode the entry ID, see Algorithm to Encode Entry IDs and Attachment IDs. Note that when viewed as text, this encoded entry ID appears as random Hangul characters or boxes, depending on available fonts.

AttachIDEncoded

Attachment ID encoded as a Unicode string. See the section "Special Characters" for information about how certain special characters get encoded. For more information about the algorithm to encode the entry ID, see Algorithm to Encode Entry IDs and Attachment IDs. Note that when viewed as text, this encoded attachment ID appears as random Hangul characters or boxes, depending on available fonts.

FileName

Name of the attachment file, as it appears in the message.

Examples of MAPI URLs

The following are some examples of MAPI URLs.

  • MAPI URL for a folder:
    
    

    mapi://S-1-5-21-2127521184-1604012920-1887927527-71418/Mailbox – Some User ($be19928f)/2/Office

    - MAPI URL for a message:
      mapi://S-1-5-21-2127521184-1604012920-1887927527-71418/Mailbox – Some User ($484efb89)/0/Calendar/곯가가가걍걝걌곌겷걢곒갑겛개가검걟곔걙곾걤곂갠가 
    
    - MAPI URL for an attachment:
      mapi://S-1-5-21-2127521184-1604012920-1887927527-71418/Mailbox – Some User ($484efb89)/0/Inbox/곯가가가걍걝걌곌겷걢곒갑겛개가검걟곔걙곾간곷갦가/at=겅걋각가:somefile.txt 
    

    Special Characters

    Certain characters are encoded if they are appear in the message or attachment. The following shows which characters are encoded in a MAPI URL:

    % -> %25

    / -> %2F

    \ -> %5C

    * -> %2A

    ? -> %3F

    Blob Associated With Each MAPI URL

    When pushing a MAPI URL for an object to be indexed, a store provider also creates a blob that contains certain information for the MAPI Protocol Handler. The store provider associates this blob with each MAPI URL and sends it when pushing the MAPI URL to the indexer. The format of the blob is the following:

      DWORD  dwVersion
    DWORD  dwFlags
    ULONG  cbProfileName
    WCHAR  wszProfileName	
    ULONG  cbProviderItemID
    WCHAR  wszProviderItemID
    

    The store provider must write these values to the blob in the order shown above. Each field of the blob is explained below.

    dwVersion

    This is the version of the data being sent. Currently this value is 1.

    dwFlags

    Reserved for future use. Currently this value should be 0.

    cbProfileName

    The size of the profile name in bytes. This information is useful for the MAPI Protocol Handler to know which profile to use when indexing the item.

    wszProfileName

    Null-terminated Unicode string that contains the profile name.

    cbProviderItemID

    Size of the provider item ID in bytes. The store provider should send the provider item ID only for folders, to prevent opening extra folders to get this information.

    wszProviderItemID

    Null-terminated Unicode string with the provider item ID that uniquely identifies the item in the store.

    See Also

    About Notification-Based Store Indexing

    Constants for the Store API