Skip to main content

Anyone able to point me in the right direction for how to do this?

 

I have the name of a potential AD Group saved as text in a Parameter in my Form.

I want to query whether an AD Group actually exists in AD using the text saved in the parameter.

If the AD group does exist, then proceed, otherwise send a message on screen and say "Easy Tiger, this group doesn't exist" and then go back to the form

 

How do I pass the parameter to check AD to see if the AD Group exists?

 

Thanks

Hi, 

 

Take a look at this link: 

 

http://help.k2.com/onlinehelp/K2smartforms/UserGuide/1.0.7/default.htm#Creating_a_Custom_Pattern.html?Highlight=validation

 

It shows how to create a valiation rule for entering text and validating weither the inputed information relates to a group. 


Hi,

 

That link talks about Validation rules on forms upon initilization.

 

How i want it, is that the user picks an option from a List. That option is transferred to a paramter (potential AD group name)

Then do a check in AD for that group name. If it exists, great, if not, quit rule.


Sharpsharp1

 

One way to achieve this is to use the GetGroups method of the AD Groups SMO (or whatever you called your AD Group SMO using the AD Service2 Service Instance).

 

You can call this method passing in the name selected in the drop down box as the Name input property, and then transfer one of the return values (e.g. Display Name) to a data label (hidden) on the form. You can then check if this control contains a value - if it does it is a valid Group name, if not then it doesn't exist.

  

Let me know if you need more clarification or an example.


Andrew this is precisely what i ended up doing. glad you said the same solution and it kind of works (amazingly).

 

I passed the parameter to Getgroups, i put up a few debug messages to check the return value when the group exists and when it doesn't. The return string in empty when the group doesn't exist.

 

Then i knocked up an advanced rule to see if the returned value CONTAINS the original paramater.

If CONTAINS is True then i assume group exists, if CONTAINS fails, I assume No group exists. After that I can do whatever action i want.

 

Thanks guys,


Reply