Heh.
It fails on the rec.Open.
I've tried (and re-tried this morning to make sure) both
the "\" escape and the "%26" escape. Neither generate a different
error.
Thanks anyway.
From: Joe [mailto:[EMAIL PROTECTED]
Sent: Monday, November 03, 2003 6:29 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] Another scripting bug...
It
probably is a bug. Wouldn't surprise me in the least. And I don't
think it would surprise anyone that I say that.
:oP
I am
not good for reading the Exchange Server side only scripts, which line
specifically blows out below? Does it fail on the rec open or the rs open? If on
the rec I would say try to escape the & with a \, if on rs try it with a %xx
where xx is the value of the & in hex which I have no clue is right this
second...
For
info, ESM appears to use MAPI instead of the DAV stuff. I could be wrong but the
traces that I have done to figure out how things work scream MAPI to me.
joe
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Michael B. Smith
Sent: Monday, November 03, 2003 2:10 PM
To: [EMAIL PROTECTED]
I
asked this question of Siegfried some time ago, and he said it was a bug. I
believe him. Does anything know a way around it, oh script guru's? Or could one
of you submit a bug report to someone that would care? :-)
I have a number of
accounts whose Exchange alias has an ampersand in it. The historical reason for
that is MS' fault, but that's neither here nor there. They just are. I use the
routine below to get the size of the mailboxes. However, for those accounts
whose alias has the ampersand in it, the open fails with the
error:
| Object or data matching the name, range, or selection criteria was not found within the scope of this operation. |
Any ideas for
working around this problem? Obviously there is SOME way, because ESM doesn't
have this issue (obviously, I'd prefer a vbscript solution -- I'm not really a
programmer these days).
Thanks,
M
Function
GetMailboxSize (strMailBoxName, strDomainName)
Dim sUserName ' As String
Dim mailboxSZ ' As Double
Dim sURL ' As String
Dim sSQL ' As String
Dim Rs ' As New ADODB.Recordset
Dim Rec ' As New ADODB.Record
On Error Resume Next
Dim sUserName ' As String
Dim mailboxSZ ' As Double
Dim sURL ' As String
Dim sSQL ' As String
Dim Rs ' As New ADODB.Recordset
Dim Rec ' As New ADODB.Record
On Error Resume Next
set Rs = Wscript.CreateObject ("ADODB.Recordset")
set Rec = Wscript.CreateObject ("ADODB.Record")
set Rec = Wscript.CreateObject ("ADODB.Record")
mailboxSZ = 0
sUsername = strMailBoxName
sURL = "file://./backofficestorage/"
& strDomainName & "/MBX/" & sUserName
Rec.Open sURL
If Err.Number <> 0 Then
strErr = "Could not open: " & sURL & " (" & err.Description & ")"
GetMailboxSize = -1
Exit Function
End If
sSQL = "Select"
sSQL = sSQL & " ""http://schemas.microsoft.com" & _
"/exchange/foldersize"" "
sSQL = sSQL & ", ""DAV:displayname"" "
sSQL = sSQL & " from scope ('deep traversal of " & Chr(34)
sSQL = sSQL & sURL & Chr(34) & "')"
sSQL = sSQL & "Where ""DAV:isfolder""=true"
Rs.Open sSQL, Rec.ActiveConnection
If Not Rs.EOF Then
Rs.MoveFirst
End If
While Not Rs.EOF
mailboxSZ = mailboxSZ + _
Rs.Fields("http://schemas.microsoft.com/exchange/foldersize").Value
Rs.MoveNext
Wend
GetMailboxSize = mailboxSZ
Rs.Close
Rec.Close
If Err.Number <> 0 Then
strErr = "Could not open: " & sURL & " (" & err.Description & ")"
GetMailboxSize = -1
Exit Function
End If
sSQL = "Select"
sSQL = sSQL & " ""http://schemas.microsoft.com" & _
"/exchange/foldersize"" "
sSQL = sSQL & ", ""DAV:displayname"" "
sSQL = sSQL & " from scope ('deep traversal of " & Chr(34)
sSQL = sSQL & sURL & Chr(34) & "')"
sSQL = sSQL & "Where ""DAV:isfolder""=true"
Rs.Open sSQL, Rec.ActiveConnection
If Not Rs.EOF Then
Rs.MoveFirst
End If
While Not Rs.EOF
mailboxSZ = mailboxSZ + _
Rs.Fields("http://schemas.microsoft.com/exchange/foldersize").Value
Rs.MoveNext
Wend
GetMailboxSize = mailboxSZ
Rs.Close
Rec.Close
set Rs = Nothing
set Rec = Nothing
End Function
set Rec = Nothing
End Function
