Become a Columnist Microsoft Exchange Site Microsoft Support SiteMSDN Exchange Site

       How did you like this article? Please vote and let us know.          

Subscribe to OutlookExchange
Anderson Patricio
Ann Mc Donough
Bob Spurzem
Brian Veal
Catherine Creary
Cherry Beado
Colin Janssen
Collins Timothy Mutesaria
Drew Nicholson
Fred Volking
Glen Scales
Goran Husman
Guy Thomas
Henrik Walther
Jason Sherry
Jayme Bowers
John Young
Joyce Tang
Justin Braun
Konstantin Zheludev
Kristina Waters
Kuang Zhang
Mahmoud Magdy
Martin Tuip
Michael Dong
Michele Deo
Mitch Tulloch
Nicolas Blank
Pavel Nagaev
Ragnar Harper
Ricardo Silva
Richard Wakeman
Russ Iuliano
Santhosh Hanumanthappa
Shannal L. Thomas
Steve Bryant
Steve Craig
Todd Walker
Tracey J. Rosenblath

 

 
 

Bug fix's for Articles in my column

The majority of the articles in my Exchange column should be considered a work in progress, some are development only scripts while some have seen the light of day as production pieces of code. As always being human means being infallible so there has been a few bugs that have creep into the articles in my column. If you have found one that I haven't listed here please let me know and I'll include it in this document.

Passing mail references from one script to another

In some of my scripts I described a method of using a small script for an event sink to execute another script and pass the URL of the message as a parameter of running this script. In the example I gave I used a for-next loop in the main script to deal with any spaces that might have been in the URL. The problem was with this piece of code is if the URL of the message has a double space (this is rare but it does happen) one of the spaces in the URL will be dropped out when its received by the other parts of the code and it will then fail to open the message up. As a solution for this if the URL is placed in double quotes the whole URL will then be taken as one big parameter.

<SCRIPT LANGUAGE="VBScript">

Sub ExStoreEvents_OnSave(pEventInfo, bstrURLItem, lFlags)
Dim DispEvtInfo
Dim WshShell
Stm = bstrURLItem
set WshShell = CreateObject("WScript.Shell")
strrun = WshShell.run ("c:\smtpevt\attachdl.vbs " & chr(34) & stm & chr(34))
set WshShell = nothing
End Sub

</SCRIPT>

Replying to messages where the email displayname has a comma in it

In a few of my scripts I've replied to messages by setting the To property of an new CDO message to the from property of the message that may have fired the event sink.(eg msgobj1.to = msgobj.from). However if the person who sent the email has a comma within their email display name eg (Scales, Glen) then CDO seems to interpret the comma in the displayname as an address separator and hence if you try and send a message you will have two address's instead of one. "One will usually be invalid". To get around this problem you need to invoke the reply method of the message that fired the sink, even if you don't intend ever sending the reply calling the reply method seems to solve the problem where the comma in the display name is interpreted as a separator.. Eg

Set msgobj = CreateObject("CDO.Message")
Set msgobj1 = CreateObject("CDO.Message")
msgobj.DataSource.Open emailurl
df = msgbox(msgobj.from)     ' This will email address in it doubled up format
set msgobj1 = msgobj.reply
df = msgbox(msgobj.from)    ' This will now display the email address okay even though you have done nothing to the original object

Using a Hierarchical traversal in Mailbox Crawl article

This one isn't so much a bug as a better way to do something. In my mailbox crawl article I'm doing a deep transversal of a mailbox to get a list of all the folders within the mailbox. A better way to do this which will use less server resources is to do a  hierarchical traversal. Eg

Rec.Open inbstr
strView = "SELECT ""DAV:href"""
strView = strView & "FROM scope ('
hierarchical  traversal of """& inbstr & """') "

 

 

 

 


Disclaimer: Your use of the information contained in these pages is at your sole risk. All information on these pages is provided "as is", without any warranty, whether express or implied, of its accuracy, completeness, fitness for a particular purpose, title or non-infringement, and none of the third-party products or information mentioned in the work are authored, recommended, supported or guaranteed by Pro Exchange. OutlookExchange.Com and Pro Exchange shall not be liable for any damages you may sustain by using this information, whether direct, indirect, special, incidental or consequential, even if it has been advised of the possibility of such damages.

© Copyright Pro Exchange, Inc., 2006