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.
For example, if you try to locate a particular item by using its
DAV:id value, the query returns two rows:
----------------------------------------------------------------
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ExOLEDb.DataSource"
objConnection.Open
"file://./backofficestorage/domain/MBX/user/Calendar/"
Set objRSet = CreateObject("ADODB.Recordset")
Set objRSet.ActiveConnection = objConnection
objRSet.CursorLocation = 3
objRSet.CursorType = 0
objRSet.LockType = 1
objRSet.Open _
"SELECT ""DAV:href"" FROM SCOPE('shallow traversal of """ & _
"file://./backofficestorage/domain/MBX/user/Calendar/" & _
"""') WHERE ""DAV:id"" = 'AQEAAAAACJlOCQAAAAAOlwsAAAAA'"
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:
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: - 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.
- There must be hyphen (-) between the GUID and the ID.
- When you change the ID to a text format, you must leave out the leading zeros.
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:
"/-FlatUrlSpace-/3B6D774A33B6D211AEB500C04FB6B4C6-287"
The following text is an example of a flat URL to a message in folder 1-287 whose MID is 1-30A:
"/-FlatUrlSpace-/3B6D774A33B6D211AEB500C04FB6B4C6-287/3B6D774A33B6D211AEB500C04FB6B4C6-30A"
The maximum size is:
http://long_server_name/long_virtual_root name/3B6D774A33B6D211AEB500C04FB6B4C6-FFFFFFFFFFFE/3B6D774A33B6D211AEB500C04FB6B4C6-FFFFFFFFFFFF
- 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.
- To have successful queries, you may have to remove the section before "/-FlatUrlSpace-/b8d01..." in the syntax from the queries. For example, you may have to remove http://servername/folder from the following query:
"http://servername/folder/-FlatUrlSpace-/b8d01...
The following section includes examples of queries.
- To test with webDAV (HTTP), run either of the following queries:
<sql> Select "http://schemas.microsoft.com/exchange/permanenturl","DAV:id
http://schemas.microsoft.com/exchange/permanenturl" FROM Scope('SHALLOW
TRAVERSAL OF ""') WHERE
"http://schemas.microsoft.com/exchange/permanenturl" =
/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1de6'
-or-
<sql> Select "http://schemas.microsoft.com/exchange/permanenturl","DAV:id
http://schemas.microsoft.com/exchange/permanenturl" FROM Scope('SHALLOW
TRAVERSAL OF ""') WHERE
"http://schemas.microsoft.com/exchange/permanenturl" =
'http://servername/folder/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1de6'
- To test with Microsoft ActiveX Data Objects (ADO) (the ExOLEDB file), run either of the following queries:
> SELECT "http://schemas.microsoft.com/exchange/permanenturl" FROM
scope('shallow traversal of
"file://./backofficestorage/mycompany.com/MBX/user/Calendar"'
file://./backofficestorage/mycompany.com/MBX/user/Calendar)
WHERE "http://schemas.microsoft.com/exchange/permanenturl" =
'/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1db5'
-or-
> SELECT "http://schemas.microsoft.com/exchange/permanenturl" FROM
scope('shallow traversal of
"file://./backofficestorage/mycompany.com/MBX/user/Calendar"'
file://./backofficestorage/mycompany.com/MBX/user/Calendar)WHERE "http://schemas.microsoft.com/exchange/permanenturl" =
'file://./backofficestorage/servername/folder/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1db5'