Microsoft KB Archive/320749

= XADM: Unexpected Results When You Use the &quot;DAV:id&quot; Property to Locate Exchange 2000 Items =

Article ID: 320749

Article Last Modified on 2/28/2007

-

APPLIES TO


 * Microsoft Exchange 2000 Server Standard Edition

-



This article was previously published under Q320749





SUMMARY
If you search an Exchange 2000 folder or an Exchange 2000 item by using ExOLEDB with SQL statements, and you use the DAV:id property to locate the item, your query may return several results instead of just one result. This behavior may occur if there are two or more items in the same folder that have the same DAV:id values in which the case is different, for example:
 * AQEAAAAACJlOCQAAAAAOlwsAAAAA

-and-


 * AQEAAAAACJlOCQAAAAAOlWSAAAAA

You can have two items in the same folder that have these DAV:id values, because these values are still unique.

The DAV:id property uniquely identifies an Exchange 2000 item. It specifies the GUID of the item (the read-only field). The DAV:id property is a base64-encoded GUID that is case-sensitive.



MORE INFORMATION
For example, if you try to locate a particular item by using its DAV:id value, the query returns two rows:

Set objConnection = CreateObject(&quot;ADODB.Connection&quot;)

objConnection.Provider = &quot;ExOLEDb.DataSource&quot;

objConnection.Open

&quot;file://./backofficestorage/domain/MBX/user/Calendar/&quot;

Set objRSet = CreateObject(&quot;ADODB.Recordset&quot;)

Set objRSet.ActiveConnection = objConnection

objRSet.CursorLocation = 3

objRSet.CursorType = 0

objRSet.LockType = 1

objRSet.Open _

&quot;SELECT &quot;&quot;DAV:href&quot;&quot; FROM SCOPE('shallow traversal of &quot;&quot;&quot; & _

&quot;file://./backofficestorage/domain/MBX/user/Calendar/&quot; & _

&quot;&quot;&quot;') WHERE &quot;&quot;DAV:id&quot;&quot; = 'AQEAAAAACJlOCQAAAAAOlwsAAAAA'&quot;

MsgBox objRSet.RecordCount 'v

To avoid this behavior, you can use either of the following properties instead of the DAV:id property to query for an item. These properties are available on all items:  http://schemas.microsoft.com/exchange/permanenturl: This property is unique across all servers. PR_INSTANCE_KEY: This property is the MAPI binary property that underlies the DAV:id property. DAV:id is not a true binary property. It is a string property whose value is computed by converting the binary property, PR_INSTANCE_KEY, to base64. The following text is the syntax for this property:

...WHERE &quot;http://schemas.microsoft.com/exchange/mapi/proptag/x0ff60102&quot; = CAST(&quot;AQEAAAAAAnm6AQAAAAACgK0AAAAA&quot; AS 'bin.base64')



If you use the permanenturl field, be aware of the following issues:  This field is the field for a permanent URL that can always be used to access an item even if the URL to the item is either renamed or moved.

For more information about the permanenturl field, visit the following Microsoft Web site:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wss/wss/_cdo_schema_exchange_permanenturl.asp

 The size of the permanenturl fields is computed according to the following conditions:

 The flat URL name uses the following format, where the folder ID (FID) and the message ID (MID) are in long format (GUID + ID). These IDs are unique on a server.  For folders:

http:// / /-FlatUrlSpace-/

</li> For messages:

http:// / /-FlatUrlSpace-/ /

</li></ul> </li> There must be hyphen (-) between the GUID and the ID.</li> When you change the ID to a text format, you must leave out the leading zeros.</li></ul>

The following text is an example of a flat URL to a folder whose FID is 1-287. This example assumes that replid 1 maps to GUID 3B6D774A33B6D211AEB500C04FB6B4C6:

&quot;/-FlatUrlSpace-/3B6D774A33B6D211AEB500C04FB6B4C6-287&quot;

The following text is an example of a flat URL to a message in folder 1-287 whose MID is 1-30A:

&quot;/-FlatUrlSpace-/3B6D774A33B6D211AEB500C04FB6B4C6-287/3B6D774A33B6D211AEB500C04FB6B4C6-30A&quot;

The maximum size is:

http:// / /3B6D774A33B6D211AEB500C04FB6B4C6-FFFFFFFFFFFE/3B6D774A33B6D211AEB500C04FB6B4C6-FFFFFFFFFFFF

</li> You cannot have two permanenturl values that differ by case that point to separate items. Computer names, virtual roots, GUIDs, and hexadecimal-format FIDs and MIDs are all defined as case-insensitive.</li> To have successful queries, you may have to remove the section before &quot;/-FlatUrlSpace-/b8d01...&quot; in the syntax from the queries. For example, you may have to remove http:// / from the following query:

&quot;http:// / /-FlatUrlSpace-/b8d01...

</li></ul>

The following section includes examples of queries.  To test with webDAV (HTTP), run either of the following queries:

Select &quot;http://schemas.microsoft.com/exchange/permanenturl&quot;,&quot;DAV:id

&quot; FROM Scope('SHALLOW

TRAVERSAL OF &quot;&quot;') WHERE &quot; &quot; =

/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1de6'

-or-

Select &quot;http://schemas.microsoft.com/exchange/permanenturl&quot;,&quot;DAV:id

&quot; FROM Scope('SHALLOW

TRAVERSAL OF &quot;&quot;') WHERE &quot; &quot; =

'http:// / /-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1de6'

</li> To test with Microsoft ActiveX Data Objects (ADO) (the ExOLEDB file), run either of the following queries:

> SELECT &quot; &quot; FROM scope('shallow traversal of

&quot;file://./backofficestorage/mycompany.com/MBX/user/Calendar&quot;'

)

WHERE &quot; &quot; =

'/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1db5'

-or-

> SELECT &quot; &quot; FROM scope('shallow traversal of

&quot;file://./backofficestorage/mycompany.com/MBX/user/Calendar&quot;'

)WHERE &quot; &quot; =

'file://./backofficestorage/ / /-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1db5'

</li></ul>

Additional query words: ExOLEDB

Keywords: kbinfo KB320749

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.