View Single Post
Old 07-23-2007, 06:13 PM   #1
blincoln
Thumbs Must Hurt
 
Join Date: Jul 2007
Location: city11 -inspectral
Model: 8100
PIN: N/A
Carrier: Cingular
Posts: 79
Default Request for testers: BES Exchange Ref ID / Folder ID script

Please Login to Remove!

Last week we ran into a situation at work where we needed to translate the Ref IDs and Folder IDs in the BES logs into the actual items in a user's mailbox. I couldn't find a way to do this, and our contact at RIM didn't know of a way either, other than poking around in the mailbox with MFCMAPI or OutlookSpy.
That's a really slow way of searching for a known ID, so I decided to write a script that would scan through a mailbox and dump some relevant information about each item as tab-delimited text. Specifically, the To/From, Subject, Sent/Received information about the items as well as the Ref ID and Folder ID tags that the BES applies. Once the data is dumped, it can be opened in e.g. Excel so that the Ref ID or Folder ID can be searched on.
This was made a little more complicated because RIM tags their custom fields using ANSI strings instead of Unicode like they're supposed to (maybe Exchange 5.5 uses ANSI? We only have 2003), but I was able to teach VBScript how to cast an ANSI string as Unicode.
Anyway, now that I think I have it working, I thought I would post it here in case anyone else would like to try it out. I would appreciate comments, and if it doesn't work for someone, it would be helpful to know which version of the BES and Exchange they are running, and on what OS(es).
The usage is from the command line, and is in the form:
cscript -nologo DumpMailboxItemData.vbs SERVER MAILBOX > Output.txt
Where SERVER is the user's Exchange server and MAILBOX is the name of the user's mailbox.
Obviously it needs to be run in the context of an account with at least read access to the target mailbox (e.g. BESAdmin).
Once the script finishes, the output text file can be opened in e.g. Excel and the Ref or Folder ID from the logs searched on.
I tested this on a 600MB mailbox being read over a WAN link and it took about half an hour. Running it locally on the Exchange server where the actual mailbox resides should be pretty speedy.
Some notes:
- Only messages created after activation are tagged with the Folder and Ref ID data.
- If a message is tagged, then the userxxx8217;s handheld is wiped and Enterprise Activated again, the previous messages will still be tagged, but those tags will not be updated by the BES. This can lead to inconsistencies in the field information for older items, particularly when trying to figure out which folder is mapped to by a particular Folder ID.
- Only email is tagged, not calendar appointments or contacts.
- Messages moved to the Deleted Items folder in Outlook do not have their Folder ID tag updated. This can be useful in determining which folder they were deleted from.
- The script can be customized to grab other fields, and/or not apply the ANSI -> Unicode cast if necessary.
Code:
Note: code removed, see updated version later in thread.
__________________
Legacy of Kain: The Lost Worlds
http://www.thelostworlds.net/

Last edited by blincoln; 11-14-2007 at 06:36 PM.. Reason: Removed old code
Offline   Reply With Quote