By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,974 Members | 1,834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,974 IT Pros & Developers. It's quick & easy.

asp page that query Exchange ldap attributes (Error 70 with External account)

P: n/a
Hi We have a simple asp page that query LDAP attribrute.

Everithing is working fine using a native domain account. but when
using an external account we have an error 70, acces denie.

Here's some basic info on our structure.
- Domain/Forest A with Exchange
- Domain/Forest B with external accounts.
- Forest A Trus Forest B and "Vice Versa"
- asp page on a Exchange FrontEnd server on default web site (same as
Exchange)
- asp page is using basic authentification.
- Authentification work fine using native domain account or External
domain Account.
- Getting native Windows attributes work fine with External account
but the attributes starting with "ms-Exch" do not come out.(Exchange
Attribute).

Here is the code I have. Maybe it's not optimise but it's feel free to
argue about it.

################################################## ######################################

<html>
<head>
<title>Boites mail over Quota</title>
</head>

<body>
<%
On Error Resume Next
Dim cComputerName

cComputerName = "server.domainA.com"

Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_Mailbox"

Dim sWinMgmts ' Connection string for WMI
Dim oWMIExchange ' Exchange Namespace WMI object
Dim lExchange_Mailboxes ' ExchangeLogons collection
Dim oExchange_Mailbox ' A single ExchangeLogon WMI object

'Write a heading into the output file
'oOutputFile.writeline("Nom BAL;Taille (KB);Nombre d'elements;Statut")
Response.Write "<table border=""1""><tr
bgcolor=""#99CCFF""><td><b><center>Nom BAL</center></b></
td><td><b><center>Taille (KB)</center></b></td><td><b><center>Nombre
d'elements</center></b></td><td><b><center>Statut</center></b></td>"

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer specified in the constant cComputerName, and
' using the CIM namespace for the Exchange provider.
sWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//"& _
cComputerName&"/"&cWMINameSpace
Set oWMIExchange = GetObject(sWinMgmts)

' Verify we were able to correctly set the object.
If Err.Number <0 Then
'oOutputFile.writeline("Error: " & err.number & ", " &
err.description)
Response.Write "<br>" & "Erreur : " & err.number & ", " &
err.description
Else
' The Resources that currently exist appear as a list of
' Exchange_Mailbox instances in the Exchange namespace.
Set lExchange_Mailboxes = oWMIExchange.InstancesOf(cWMIInstance)

' Were any Exchange_Mailbox Instances returned?
If (lExchange_Mailboxes.count 0) Then
' If yes, do the following:
' Iterate through the list of Exchange_Mailbox objects.
For Each oExchange_Mailbox in lExchange_Mailboxes
Select Case oExchange_Mailbox.StorageLimitInfo
Case 2
Response.Write "<tr bgcolor=""#FFFF33""><td>" &
oExchange_Mailbox.MailboxDisplayName & "</td><td>" &
oExchange_Mailbox.Size & "</td><td>" & oExchange_Mailbox.TotalItems &
"</td><td>" & oExchange_Mailbox.StorageLimitInfo & "</td>"
Case 4
Response.Write "<tr bgcolor=""#FF0000""><td>" &
oExchange_Mailbox.MailboxDisplayName & "</td><td>" &
oExchange_Mailbox.Size & "</td><td>" & oExchange_Mailbox.TotalItems &
"</td><td>" & oExchange_Mailbox.StorageLimitInfo & "</td>"
End Select
Next
Response.Write "</table>"
Else
' If no Exchange_Mailbox instances were returned,
' display that.
Response.Write "WARNING: No Exchange_Mailbox instances were
returned."
End If
End If
%>
</body>
</html>
################################## End of Code
#############################################"
If you think I should post on other newsgroup, please let me know
witch one.

Best regards.

Christian

Apr 23 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The best group to publish to is:
microsoft.public.inetserver.asp.general

This group is an ASP.NET group and you may not get an answer.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com

*********************************************
Think outside the box!
*********************************************
<ou******@gmail.comwrote in message
news:11*********************@n59g2000hsh.googlegro ups.com...
Hi We have a simple asp page that query LDAP attribrute.

Everithing is working fine using a native domain account. but when
using an external account we have an error 70, acces denie.

Here's some basic info on our structure.
- Domain/Forest A with Exchange
- Domain/Forest B with external accounts.
- Forest A Trus Forest B and "Vice Versa"
- asp page on a Exchange FrontEnd server on default web site (same as
Exchange)
- asp page is using basic authentification.
- Authentification work fine using native domain account or External
domain Account.
- Getting native Windows attributes work fine with External account
but the attributes starting with "ms-Exch" do not come out.(Exchange
Attribute).

Here is the code I have. Maybe it's not optimise but it's feel free to
argue about it.

################################################## ######################################

<html>
<head>
<title>Boites mail over Quota</title>
</head>

<body>
<%
On Error Resume Next
Dim cComputerName

cComputerName = "server.domainA.com"

Const cWMINameSpace = "root/MicrosoftExchangeV2"
Const cWMIInstance = "Exchange_Mailbox"

Dim sWinMgmts ' Connection string for WMI
Dim oWMIExchange ' Exchange Namespace WMI object
Dim lExchange_Mailboxes ' ExchangeLogons collection
Dim oExchange_Mailbox ' A single ExchangeLogon WMI object

'Write a heading into the output file
'oOutputFile.writeline("Nom BAL;Taille (KB);Nombre d'elements;Statut")
Response.Write "<table border=""1""><tr
bgcolor=""#99CCFF""><td><b><center>Nom BAL</center></b></
td><td><b><center>Taille (KB)</center></b></td><td><b><center>Nombre
d'elements</center></b></td><td><b><center>Statut</center></b></td>"

' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=impersonate),
' on the computer specified in the constant cComputerName, and
' using the CIM namespace for the Exchange provider.
sWinMgmts = "winmgmts:{impersonationLevel=impersonate}!//"& _
cComputerName&"/"&cWMINameSpace
Set oWMIExchange = GetObject(sWinMgmts)

' Verify we were able to correctly set the object.
If Err.Number <0 Then
'oOutputFile.writeline("Error: " & err.number & ", " &
err.description)
Response.Write "<br>" & "Erreur : " & err.number & ", " &
err.description
Else
' The Resources that currently exist appear as a list of
' Exchange_Mailbox instances in the Exchange namespace.
Set lExchange_Mailboxes = oWMIExchange.InstancesOf(cWMIInstance)

' Were any Exchange_Mailbox Instances returned?
If (lExchange_Mailboxes.count 0) Then
' If yes, do the following:
' Iterate through the list of Exchange_Mailbox objects.
For Each oExchange_Mailbox in lExchange_Mailboxes
Select Case oExchange_Mailbox.StorageLimitInfo
Case 2
Response.Write "<tr bgcolor=""#FFFF33""><td>" &
oExchange_Mailbox.MailboxDisplayName & "</td><td>" &
oExchange_Mailbox.Size & "</td><td>" & oExchange_Mailbox.TotalItems &
"</td><td>" & oExchange_Mailbox.StorageLimitInfo & "</td>"
Case 4
Response.Write "<tr bgcolor=""#FF0000""><td>" &
oExchange_Mailbox.MailboxDisplayName & "</td><td>" &
oExchange_Mailbox.Size & "</td><td>" & oExchange_Mailbox.TotalItems &
"</td><td>" & oExchange_Mailbox.StorageLimitInfo & "</td>"
End Select
Next
Response.Write "</table>"
Else
' If no Exchange_Mailbox instances were returned,
' display that.
Response.Write "WARNING: No Exchange_Mailbox instances were
returned."
End If
End If
%>
</body>
</html>
################################## End of Code
#############################################"
If you think I should post on other newsgroup, please let me know
witch one.

Best regards.

Christian
Apr 23 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.