Contents
Look up [Back to top]
We are able to do a lookup in the Active Directory, and support grabbing various values for a given object and insert them into the document. Thus, the feature opens an interface that enables to search in Active Directory and then insert the chosen user. The user will be inserted in a content control that has a binding. This binding defines which values that should be inserted.
Module is located here:
...\ModuleLibrary\ActiveDirectory\01_nocontext_ActiveDirectory
CMD
<Cmd case="SkabelonDesign.AD:AD" prefix="x" include="x" title="x" ouPath="x" dcPath="x" onlyUsername="x"/>
Parameters
prefix
Define the prefix, e.g. "AD". The prefix should be written in the binding in the content control tag.
include
We are able to include custom attributes from Active Directory. This means that we can grab more values than the ones described below. These attributes can be found by using search for attributes.
To include several attributes, define the name of them in this parameter. They must be named as they are named in the LDAP language. If there are more than one attribute, they must be separated with semicolon.
title
Define the title of the interface that opens, when running the command, e.g. "SkabelonDesign".
onlyUsername
If true
, the command will only search for usernames in the AD, instead of also displayname and email. Default is false
.
Targetting specific units
There are two optional parameters that must both be defined when targeting specific groups in the AD. Get the values from the clients AD administrator. Paths are written bottom-up and separated using semi-colon.
ouPath
Path for the Organizational Unit.
dcPath
Path for the Domain Component.
Binding
As mentioned, we use content controls to receive the data, thus there must be a tag in the certain content control, where the grabbed values should be inserted. This is the binding that should be inserted in the tag:
{"SkabelonDesign":{"type":"Text","binding":"prefix.Value"}}
The prefix in the binding must be replaced with whatever is defined in the prefix parameter in the command. For instance, if you have written AD
in the command above, this is your prefix.
There are various values to get from the Active Directory:
- Name (The display name of the user)
- UserName (The user name of the user, e.g. initials)
- Email (The e-mail address of the user)
- PhoneNumber (The telephone number of the user)
- MobileNumber (The mobile number of the user)
- JobTitle (The job title of the user)
- Department (The department of the user)
Example
Let's say you have a document, where you want to insert name and e-mail of a certain user. Thus, you must create two content controls and insert the binding above in their tags to enable them to receive the data. In the first one, where the name should be inserted, the binding should look like this:
{"SkabelonDesign":{"type":"Text","binding":"AD.Name"}}
Just like the binding in the second content control should look like this:
{"SkabelonDesign":{"type":"Text","binding":"AD.Email"}}
When clicking at the button, you will be able to search for a user in Active Directory. Now, the name and e-mail address of the chosen user will be inserted in your created content controls.
Search in attributes [Back to top]
This feature is to be used for configuration. We are able to list all fields (key/value) in Active Directory, thus a search box will open where you are able to search for the initials of a user and then the feature will show a list of attributes that can be used in configuration of either bindings or in the include
parameter from the look up command described above.
Select an item from the list and click OK. Now, the selected attribute is copied to your clipboard.
Module is located here:
...\ModuleLibrary\ActiveDirectory\01_nocontext_ActiveDirectory
CMD
<Cmd case="SkabelonDesign.AD:info"/>
Direct insert [Back to top]
With this feature, we are able to insert a specific user directly into the document. The command can be used as it is, but the use-case is that we fetch some data using another DocumentData
plugin, and then find a user to be inserted based on this information.
Module is located here:
...\ModuleLibrary\ActiveDirectory\01_nocontext_ActiveDirectory
CMD
<Cmd case="SkabelonDesign.AD:DirectInsert" prefix="x" query="x" />
Parameters
prefix
Define the prefix, e.g. "AD". The prefix should be written in the binding in the content control tag.
query
Define a search query. This must be written in LDAP language.
As an example, a query could be (&(objectCategory=Person)(samaccountname={UserName}))
which will search for a person and insert the initials.
Example of usage
As mentioned, the use-case is to use this command in conjunction with another DocumentData
. Here is an example with description below:
<Button label="Direct Insert">
<cmd case="SkabelonDesign.DocumentData:EnablePendingChanges"/>
<cmd case="SkabelonDesign.DocumentData:DefineData" variableName="UserName">
<Doc.Prop.UserName>
<Doc.Prop.UserName/>
</Doc.Prop.UserName>
<s>cjl</s>
</cmd>
<Cmd case="SkabelonDesign.AD:DirectInsert" prefix="AD" query="(&(objectCategory=Person)(samaccountname={UserName}))"/>
</Button>
At first, pending changes are enabled. Afterwards, the variable UserName
is defined as my key. Inside this key, I have defined that what should be inserted in the content control should come from the document property UserName
. If this document property does not exist, the key will instead be the string cjl
. Finally, the command of this article is called. Let's say I have a content control where the binding takes the prefix AD
and the value Name
, this function will take whatever the query finds to be UserName
and insert the name of this user directly into my content control.
Imaging that a document property called UserName
is present in the document and it has seb
as value. The query will take seb
as UserName
, and thus insert "Sebastian Dirk Elk" into the content control. If this document property is not present, the query instead takes the string cjl
as UserName
, which will insert "Cecilie Jasco Lawson" into the content control.
Notice that the content control must have a binding in its tag to receive the data. Read more about that in this article.
Comments
0 comments
Article is closed for comments.