Programming Microsoft Outlook and Microsoft Exchange 2003, Third Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Programming Microsoft Outlook and Microsoft Exchange 2003, Third Edition [Electronic resources] - نسخه متنی

Thomas Rizzo

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
توضیحات
افزودن یادداشت جدید











The Org Chart Sample Application

To show you another example of how to use your ADSI skills against the Active Directory, I created a simple Web-based application that draws an organizational chart. Figure 13-8 shows the application's logon page, where the user can type the name of a person and execute an ASP page that sets the correct credentials for the directory and then calls the organizational chart ASP program.


Figure 13-8: The logon page for the ADSI Org Chart application

ADSI makes working with Active Directory and Exchange Server information easy. The code for the query follows.

<%
'Get information from Active Directory
Set oIADs = GetObject("LDAP:")
bstr1 = "LDAP://" + Session("Server") + "/cn=" + strUser + ",cn=" + _
Session("cn") + ",dc=" + Session("Domain") + ",dc=" + _
Session("DC") + ",dc=" + Session("OU") + ",dc=" + Session("o")
bstr2 = Session("bstr2")
bstr3 = Session("bstr3")
Set objIADs = oIADs.OpenDSObject(bstr1, bstr2, bstr3, 0)
'Response.Write objIADs.Get("manager")
'Get the current person's information
strDisplayName = objIADs.Get("displayName")
strOffice = objIADs.Get("physicalDeliveryOfficeName")
strTelephone = objIADs.Get("telephoneNumber")
strTitle = objIADs.Get("title")
strcn = objIADs.Get("cn")
'Try to retrieve the Mail property
strmail = "
strmail = objIADs.Get("mail")
If strmail = " Then
'Try getting mailNickname
strmail = objIADs.Get("mailNickname")
End If
'Response.Write "strcn= " & strcn
strManager = objIADs.Get("manager")
'Response.Write strManager
strManagerPath = "LDAP://" & Session("Server") & "/" & strManager
'Response.Write strManagerPath
set oIADsManager = oIADS.OpenDSObject(strManagerPath,bstr2,bstr3,0)
strManagercn = oIADsManager.Get("cn")
'Try to retrieve the Mail property
strManagerMail = "
strManagerMail = oIADsManager.Get("mail")
If strManagerMail = " Then
strManagerMail = oIADsManager.Get("mailNickname")
End If
'Response.Write "mcn=" & strManagercn
strManagerOffice = oIADsManager.Get("physicalDeliveryOfficeName")
strManagerTelephone = oIADsManager.Get("telephoneNumber")
strManagerTitle = oIADsManager.Get("title")
strManagerDisplayName = oIADsManager.Get("displayName")
strReports = objIADs.GetEx("directReports")
%>
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<Title>Web Org-Chart (java version)</Title>
</HEAD>
<center><font face=Verdana size=6><B>From Active
Directory</B></center></font>
<p align="CENTER">
<applet
codebase="java"
code=JOrgChart.class
id=JOrgChart
width=480
<% if UBound(strReports) = LBound(strReports) then
iHeight = 0
else
iHeight = UBound(strReports)
end if
%>
height=<%=(Int(iHeight/2)+3)*65%>>
<param name=HostName value="<% =ROOTURL %>?Alias=">
<param name=Root value="<%=strManagerDisplayName%>?
<%=strManagerMail%>?
<%=EmptyToNA(strManagerTitle)%>?
<%=EmptyToNA(strManagerOffice)%>?
<%=EmptyToNA(strManagerTelephone)%>">
<param name=L1Node
value="<%=strDisplayName%>?<%=strMail%>?<%=EmptyToNA(strTitle)%>?<%=Empty
ToNA(strOffice)%>?<%=EmptyToNA(strTelephone)%>">
<%
For i = LBound(strReports) To UBound(strReports)
strLogonName = left(strReports(i),(instr(1,strReports(i),",")-1))
'Get each DS object to return the friendly name
strDirectPath = "LDAP://" & Session("Server") &
"/" & strReports(i)
set oIADsReports = oIADs.OpenDSObject(strDirectPath, bstr2,bstr3,0)
strReportscn = oIADsReports.Get("cn")
'Try to get the mail address
strReportsMail = "
strReportsMail = oIADsReports.Get("mail")
If strReportsMail = " Then
strReportsMail = oIADsReports.Get("mailNickname")
End If
strReportsOffice = oIADsReports.Get("physicalDeliveryOfficeName")
strReportsTelephone = oIADsReports.Get("telephoneNumber")
strReportsTitle = oIADsReports.Get("title")
strReportsDisplayName = oIADsReports.Get("displayName")
%>
<param name=L2Node<%=i%> value="<%=strReportsDisplayName%>?
<%=strReportsMail%>?
<%=EmptyToNA(strReportsTitle)%>?
<%=EmptyToNA(strReportsOffice)%>?
<%=EmptyToNA(strReportsTelephone)%>">
<%
Next
%>
</applet>
</p>
<P>
<B>Select a different alias by clicking <a href="logon.asp">here.</B>
</BODY>

/ 227