Gotcha - PermanentURL & WebDAV Series # 1


                    Le Café Central de
Deva              

                                 
                                 ..... Deva blogs!!




 

 

Gotcha - PermanentURL & WebDAV Series # 1

Rate This
  • Comments 4

Take this scenario. One of my customer wanted to updated the contact fields using PR_ENTRY_ID and other fields. He can able to obtain the other all fields and getting issue with this property whenever he retrieve using WebDAV·  He gets garbage values at one client and another client it leads him to Exception.

In this scenario, instead of using the MAPI property, we can make use of PermanentURL. In order to access the property we need to make use of the following property:

 
Note: This property is unique across all servers.

There are certain things that needs to be considered when we use the PermanentURL is listed below:

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.

. 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://server/virtual_root/-FlatUrlSpace-/text-format-fid-of-folder

. For messages: http://server/virtual_root/-FlatUrlSpace-/text-format-fid-of-folder/text-format-mid-of-message

. 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:

   1:  "/-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:

   1:  "/-FlatUrlSpace-/3B6D774A33B6D211AEB500C04FB6B4C6-287/3B6D774A33B6D211AEB500C04FB6B4C6-30A" 

The maximum size is:

   1:  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:

   1:  <sql> Select "http://schemas.microsoft.com/exchange/permanenturl","DAV:id 
   2:   
   3:  http://schemas.microsoft.com/exchange/permanenturl" FROM Scope('SHALLOW 
   4:   
   5:  TRAVERSAL OF ""') WHERE "http://schemas.microsoft.com/exchange/permanenturl" = 
   6:   
   7:  /-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1de6'

-or-

   1:  <sql> Select "http://schemas.microsoft.com/exchange/permanenturl","DAV:id 
   2:   
   3:  http://schemas.microsoft.com/exchange/permanenturl" FROM Scope('SHALLOW 
   4:   
   5:  TRAVERSAL OF ""') WHERE "http://schemas.microsoft.com/exchange/permanenturl" = 
   6:   
   7:  '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:

   1:  SELECT "http://schemas.microsoft.com/exchange/permanenturl" FROM scope('shallow traversal of 
   2:   
   3:  "file://./backofficestorage/mycompany.com/MBX/user/Calendar"' 
   4:   
   5:  file://./backofficestorage/mycompany.com/MBX/user/Calendar) 
   6:   
   7:  WHERE "http://schemas.microsoft.com/exchange/permanenturl" = 
   8:   
   9:  '/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1db5' 

-or-

   1:  SELECT "http://schemas.microsoft.com/exchange/permanenturl" FROM scope('shallow traversal of 
   2:   
   3:  "file://./backofficestorage/mycompany.com/MBX/user/Calendar"' 
   4:   
   5:  file://./backofficestorage/mycompany.com/MBX/user/Calendar)WHERE "http://schemas.microsoft.com/exchange/permanenturl" = 
   6:   
   7:  'file://./backofficestorage/servername/folder/-FlatUrlSpace-/b8d014e9f474644ba656cb6adcef9d7b-1c/b8d014e9f474644ba656cb6adcef9d7b-1db5'  
  • PingBack from http://www.tmao.info/gotcha-permanenturl-webdav-series-1/

  • Fantastic post. I was trying in vain to query public contacts by permanenturl but kept getting that cryptic and elusive "400 Bad Request" message. Turned out that  my syntax was off just a tad. Thanks for providing WORKING examples, something the Internet is sorely lacking in the Exchange/WebDAV department.

  • By the way, I find that the version of the search query that strips everything before "/-FlatUrlSpace-/" is the only one that works for me. The one that uses the complete full permanent URL doesn't seem to return any results.

  • With continuation to previous blog post , this article describes how to access items in a WebDAV application

Page 1 of 1 (4 items)
Blog - Post Feedback Form(CAPTCHA)
Leave a Comment
  • Post