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

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

am 23.04.2007 16:59:11 von ouistyty

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.


############################################################ ###############=
=AD
#############




Boites mail over Quota




<%
On Error Resume Next
Dim cComputerName


cComputerName =3D "server.domainA.com"


Const cWMINameSpace =3D "root/MicrosoftExchangeV2"
Const cWMIInstance =3D "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 "

bgcolor=3D""#99CCFF"">"


' Create the object string, indicating WMI (winmgmts), using the
' current user credentials (impersonationLevel=3Dimpersonate),
' on the computer specified in the constant cComputerName, and
' using the CIM namespace for the Exchange provider.
sWinMgmts =3D "winmgmts:{impersonationLevel=3Dimpersonate}!//"& _
cComputerName&"/"&cWMINameSpace
Set oWMIExchange =3D 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 "
" & "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 =3D
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 " bgcolor=3D""#FFFF33"">"
Case 4
Response.Write " bgcolor=3D""#FF0000"">"
End Select
Next
Response.Write "
Nom BAL
td>
Taille (KB)
Nombre
d'elements
Statut
" &
oExchange_Mailbox.MailboxDisplayName & "
" &
oExchange_Mailbox.Size & "
" & oExchange_Mailbox.TotalItems &
"
" & oExchange_Mailbox.StorageLimitInfo & "" &
oExchange_Mailbox.MailboxDisplayName & "
" &
oExchange_Mailbox.Size & "
" & oExchange_Mailbox.TotalItems &
"
" & oExchange_Mailbox.StorageLimitInfo & "
"
Else
' If no Exchange_Mailbox instances were returned,
' display that.
Response.Write "WARNING: No Exchange_Mailbox instances
were
returned."
End If
End If
%>




################################## End of Code
#############################################"


If you think I should post on other newsgroup, please let me know
witch one.


Best regards.


Christian

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

am 25.04.2007 09:54:53 von ouistyty

On 23 avr, 16:59, ouist...@gmail.com wrote:
> 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.
>
> ############################################################ #############=
##­­
> #############
>
>
>
> Boites mail over Quota
>
>
>
> <%
> On Error Resume Next
> Dim cComputerName
>
> cComputerName =3D "server.domainA.com"
>
> Const cWMINameSpace =3D "root/MicrosoftExchangeV2"
> Const cWMIInstance =3D "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 "

> bgcolor=3D""#99CCFF"">"
>
> ' Create the object string, indicating WMI (winmgmts), using the
> ' current user credentials (impersonationLevel=3Dimpersonate),
> ' on the computer specified in the constant cComputerName, and
> ' using the CIM namespace for the Exchange provider.
> sWinMgmts =3D "winmgmts:{impersonationLevel=3Dimpersonate}!//"& _
> cComputerName&"/"&cWMINameSpace
> Set oWMIExchange =3D 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 "
" & "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 =3D
> 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 " > bgcolor=3D""#FFFF33"">"
> Case 4
> Response.Write " > bgcolor=3D""#FF0000"">"
> End Select
> Next
> Response.Write "
Nom BAL
> td>
Taille (KB)
Nombre
> d'elements
Statut
" &
> oExchange_Mailbox.MailboxDisplayName & "
" &
> oExchange_Mailbox.Size & "
" & oExchange_Mailbox.TotalItems &
> "
" & oExchange_Mailbox.StorageLimitInfo & "" &
> oExchange_Mailbox.MailboxDisplayName & "
" &
> oExchange_Mailbox.Size & "
" & oExchange_Mailbox.TotalItems &
> "
" & oExchange_Mailbox.StorageLimitInfo & "
"
> Else
> ' If no Exchange_Mailbox instances were returned,
> ' display that.
> Response.Write "WARNING: No Exchange_Mailbox instances
> were
> returned."
> End If
> End If
> %>
>
>
>
> ################################## End of Code
> #############################################"
>
> If you think I should post on other newsgroup, please let me know
> witch one.
>
> Best regards.
>
> Christian

up.
No one can help me ?
Regards.
Christian