Linking Access to an Exchange or Outlook Table – Mapi Tags and Schema.ini

This is basically a note to myself, because I did it a few years ago and have broken the table links. It’s no fun to find all the old documentation, so I’m noting the main points here.

Access 2000 uses the Jet IISAM to link an Access table to Outlook or Exchange. It generates a file called Schema.ini that basically tells IISAM what columns in the MAPI store will map to the columns in your linked table in Access.

Normally the schema.ini file is generated automatically, but if your MAPI table contains custom outlook forms, then these will break the linking between Access and Outlook (or Exchange). In this case, you need to modify the schema.ini file manually. There was a nice article about how to do this in Smart Access (Aug 2000) which Microsoft has reprinted here. There is reference to a second article which is more difficult to find called Accessing Exchange: Delving a Little Bit Deeper into the Jet 4.0 IISAM which describes how to use the MDBVUE.EXE tool, which I’ve summarized here with changes specific to my project.

Here is a typical schema.ini file that helps Access connect to a folder called Billing Contacts in the Public Folders:

[1 – Outlook – Billing Contacts]
IdSize=46
IdBytes=00 00 00 00 1A 44 73 90 AA 66 11 CD 9B C8 00 AA 00 2F C4 5A 03 80 85 13 1D 62 85 DE C9 40 93 7D B3 C9 B9 34 DC EA 00 00 00 00 FF 85 00 00
Col1=”Message Class” Char Width 510 Tag 1703966
Col2=Title Char Width 510 Tag 974585886
Col3=Account Char Width 510 Tag 7340062
Col4=”File As” Char Width 510 Tag -2120286178
Col5=”Home Address” Char Width 510 Tag -2137194466
Col6=”Business Address” Char Width 510
Col7=Phone Char Width 510
Col8=”Mobile Phone” Char Width 510
Col9=”Home Phone” Char Width 510

The article goes over the structure of the file, but the part I forgot was how to generate the “Tag” attribute for the non-standard fields. You actually need to dig into the guts of the MAPI store to find it.

“The Tag value in the Schema.ini file combines the DISPID of the column (a unique number that’s assigned to each column) in the top two bytes, and the datatype from Table 3 in the bottom two bytes.” (Table 3 is in the article, which is reproduced on Microsoft’s website but you don’t actually need the table, because MDBVUE will tell you the value.)

You then need to use MDBVUE.EXE tool from Microsoft to open the MAPI store and examine the DISPID and the DATATYPE directly.

One of the broken columns in my linked table was the “Home Address” column, which looked like this in the previous schema.ini file:

Col5=”Home Address” Char Width 510 Tag -2137194466

I needed to calculate the new Tag using the MDBVUE tool. After connecting to the store, open one of the actual items within the IPM folder (in this case one of the contacts withing Billing Contacts) and click on the Property Interface button, which opens another window. At the bottom of the window, select Hex. Find a row with what looks like a home address. The left column contains the DISPID (red circled in the screenshot, value is 0X8095) and the center column contains the datatype (red circled, value is 0X001E).

Screenshot of browsing an Item with MDBVUE Screenshot of Item Properties window in MDBVUE

Concatenated, these values are 0X8095001E and converting to signed long integer, this is -2137718754 . Note: you can convert using the Immediate Window in Visual Basic (open Access > Tools > Macro > Visual Basic Editor… then in the editor >View > Immediate Window, and type into the Immediate Window print &H8095001E and hit Enter to see the converted value.

 

So that row in the schema.ini file becomes:

Col5=”Home Address” Char Width 510 Tag -2137718754

 

Repeat with the other custom entries in the schema.ini file and save. The restart Access and open the linked table to see if it works.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: