CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeChargeStudio.Discussion

 active directory / adsl data usage ???

Print topic Send  topic

Author Message
Christian Presslmayer
Posted: 09/19/2003, 4:52 AM

in an actual project i have to combine data of 3 different datasources:
1) data from a sql server 2000 / W2K machine
2) data from a db2 / as400 hoste
3) data from the active directory of the W2K domain controller

the usage of sql and db2 via ole db is no problem in codecharde studio 2x,
but did anybody test the data usage from w2k ad? there is a ole db provider
to configure the data access, but has anybody successfully use this in
combination with codecharge studio 2x?

if yes, do you have sample code or simple advices for me?

thanks,
Christian

DonB
Posted: 09/19/2003, 6:22 PM

No experience using it with CCS, but yes you can access AD from ADO. There
is quite a bit of this described in the Microsoft "Platform SDK" which is
part of the MSDN subscription service (but I think also can be found at
msdn.microsoft.com).

Here is one snippet from the SDK:
Phone List Sample Code
' This code modifies the Phone number property of a mailbox. By
' default, all users have access to modify this property on their own
' mailbox.
' This following code will cause the browser to display a user
' identification dialog. The IIS server's password authentication must
' be set to Allow Anonymous and Basic (Clear Text) only. This way, the
' browser will be able to use the correct security context when using
' the GetObject method.

Dim strAT ' Authorization Type information
strAT = Request.ServerVariables("AUTH_TYPE")
If InStr(1, "_BasicNTLM", strAT, 1) < 2 Then
Response.Buffer = True
Response.Status = ("401 Unauthorized")
Response.End
End If
Dim strMailboxPath ' ADsPath to the user's mailbox
Dim strServer ' name of the Microsoft Exchange 5.5 server
Dim intPosPrefix ' numeric index used used to build ADsPath to
schema object
Dim intPosSuffix ' numeric index used used to build ADsPath to
schema object
Dim strPrefix ' prefix string used to build ADsPath to schema
object
Dim strSuffix ' suffix string used to build ADsPath to schema
object
Dim strPathToSchemaObject ' ADsPath to the schema object
Dim objMailbox ' mailbox object
Dim strNewPoneNumber ' value of the new phone number
Function isUserEditable(strSchemaObjectPath)
Dim objSchemaObject ' schema object
Dim intValue ' value of the 'Access-Category' property
Set objSchemaObject = GetObject(strSchemaObjectPath)
intValue = objSchemaObject.Get("Access-Category")
If intValue = 2 Then ' user may modify the mailbox property
isUserEditable = True
Else ' the value was 0, 1, or 3
isUserEditable = False
End If
End Function

' The following procedure modifies the property of an object that
' contains a string value. To set a property to the empty string,
' you must remove it from the object:

Sub ModifyProperty(strNewValue, strADsProperty)
On Error Resume Next
If Len(strNewValue) <> 0 Then
objMailbox.Put strADsProperty, CStr(strNewValue)
Else ' The new value is empty
objIADs.Get (strADsProperty)

' If the property doesn't exist on the object, an error will be
' generated:

If Err.Number = 0 Then
' the property exists on the object and must be removed
objMailbox.PutEx ADS_PROPERTY_CLEAR, strADsProperty, CStr(" ")
End If
Err.Clear
End If
End Sub
Const ADS_PROPERTY_CLEAR = 1
' used by the PutEx method to clear a property from an object
strMailboxPath = "LDAP://SPARKER1/cn=SParker,cn=Recipients,ou=3081,o=16"
strServer = "sparker1"
strNewPoneNumber = "(425) 882-8080 x 13882"
intPosPrefix = InStr(strMailboxPath, "/cn")
intPosSuffix = InStr(strMailboxPath, "ou")
strPrefix = Mid(strMailboxPath, 1, intPosPrefix - 1) + "/cn="
strSuffix = ",cn=Microsoft DMD," + Mid(strMailboxPath, intPosSuffix,
Len(strMailboxPath))
strPathToSchemaObject = strPrefix + "Telephone-Office1" + strSuffix
If isUserEditable(strPathToSchemaObject) Then
Set objMailbox = GetObject(strMailboxPath)
ModifyProperty strNewPoneNumber, "telephoneNumber"
objMailbox.SetInfo ' save the object information
Response.Write "Phone number modified successfully :)<BR>"
Else
Response.Write "You don't have permissions to modify your phone number
:(<BR>"
End If
%>
--
DonB

http://www.gotodon.com/ccbth


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.