Documente Academic
Documente Profesional
Documente Cultură
2 Configuring AD
At first sight this is how our AD looks like:
Now we are going to create an Organization Unit structure with groups and
users. For example I am going to user this structure:
The AD structure is shown in the images below. For each user we have to
insert some configuration for the description, telephone, email, etc. In this case we
are going to load information only for these fields.
Ilustracin 2 AD Groups
Ilustracin 3 AD Users
For creating an Organization Unit we have to click with right bottom and in
the new section click on Organization Unit. A new window is opened and there we
have to write a name for the Organization Unit.
For creating groups we have to click with right bottom and in the new section
click on Group. A new window is opened and there we have to insert the name of
the group. In addition in the Group scope section we have to select Universal.
For creating users we have to do the same but we have to choose User
instead of Group.
3 AD Considerations
In order to connect to AD and get groups and users we have to create a
connection from .Net. This connetion has the follow LDAP structure:
LDAP://ObjectNaming=value,ObjectNaming=value2,,ObjectNaming=valuen
Where ObjectNaming has the follow range of values:
-
OU = Organization Unit.
CN = Common Name.
DC = Domain Component.
For example, for our system, if we want to search all the groups in the Org Chart
we have created the connection will be:
LDAP://OU=Groups,OU=Malaga,OU=Avanade,DC=coecollabmlg,DC=com
4 Configuring Environment
We have to create a site collection where we are going to locate the WebPart
that will show the Org Chat. For doing that go to Central Administration and under
Application Management click on Create site collections and create the site
collection as shown in the illustration below.
The code necessary for the .ascx file is shown in the illustration below:
Some properties
We create two properties: the path to connect with AD and the groups that
are going to be created as headers. We have to mention that these properties can
be located wherever we want, for example as a WebPart configurable property.
Page_Load Event
CreateHeaderNodes() method.
In this method we get groups and create the nodes for the treeview.
-
GetGroups() method.
In this part of the code we build the filter for bringing the groups that are
going to be the tree view headers.
And in the last part of this method we get the groups and insert their names in a
list<string> object.
This method is used to get all the members for a given group. It will be used
when user click on a group and expand it.
TreeNodeExpanded event
This event is trigged every time the user chick on a group and this group is
expanded. In this method we get the name of the group and get all members. For
each member a new node has to be created for the TreeView. That is what we do in
this method.
An important details is that if the node that is expanded has already child nodes (it
was populated time before) this event do nothing, only expand the node.
TreeNodeSelectedChange event
This event is trigged every time an user click on a user, that is the last element of
the tree. The code inside this event gets the name of the user and the path for
searching this user. It means that we can set a member of one of our groups an user
located in other groups in AD. It calculated the path dynamically where we have to
search the user. This event write the value of the properties for this user. In this
case we have used the description, the telephone, the email and the name of the
user.
GetProperty() method.
This method is used as an auxiliary method in order to get the value of a property
inside of a SearchResult object.