Query LDAP

  • 17 December 2014
  • 11 replies
  • 220 views

Badge +1

Hi All,

I am just trying to see if a users email exists in our Active Directory. I seem to be having trouble getting any results. I am sure its something I am doing wrong.

I am using (&(objectClass=user)(mail={WorkflowVariable:E-mail Address})) to get the users email address. I am unsure on what value I need to be putting into [Property to Retrieve].

Essentially after that I just want to have a decision tree. If it exists - email Initiator - else Create AD user.

Any help is much appreciated.

A


11 replies

Badge +6
  1. Try one of the following queries:
    1. If you have the username: (&(objectClass=user)(sAMAccountName={username of the user to retrieve the email from}))
    2. If you only have the email address: (&(objectClass=user)(mail={WorkflowVariable:E-mail Address}))

      That will return all the properties of the user you are looking for.

  2. Then as the property to retrieve select "mail" and store it in a variable
  3. After the LDAP query simply check whether the variable you are storing the result in is empty or not. if it is, then the user doesn't have an email set.
Badge +1

That is perfect – I got it working – I will jump on the site and mark as the right answer.

Thanks mate.

A

Badge +6

Hi Patrick,

This was very help thank you. Do you perhaps know how to get the fields that have space in them. For some reason I managed to get he results back but for the columns that has space in between I get nothing back.

Regards

Bhuti

Badge +6

Hi Patrick Hosch,

I thought I should clarify, to be exact I am looking to pull the "Work Phone" out but I always get empty string but I can get results for Title, Name etc. All the Fields that have one name without a space they get returned.

Regards

Bhuti

Badge +6

Bhuti, the "Work Phone" property is a SharePoint user profile property. The property you want to get from AD is "telephoneNumber".

Here is a list of all properties in SP and their corresponding AD properties. Also note, that properties with spaces in their name in SharePoint have an internal field name that has NO spaces. The internal field name is the one being used when working with SP user profiles.

Badge +6
Thank you, that will be very helpful indeed.


Regards


Bhuti


Badge +4

Hi Patrick,

This sounds like the specific solution I need, but I can only get the proper result with Run Now (replacing the variable with the username) and no results are returned with the variable. 

  • My input variable is single line text & I've also ensured via logging@ that it does not/appears to not have extra spaces
  • I am also testing with myself as I have the data and an email address
  • I have set up my Query LDAP as you noted in 1.1 (using an input variable for the username (the sAMAccountName). 

Can you point me in the right direction?

Thank you for any information you can provide. 

Badge +6

Have you tried wrapping the variable around {TextStart} and {TextEnd} to indicate a block of text that should not be parsed further?

Additionally, although you have made sure there is no spaces at the beginning/end - you could do this via RegEx, just to be 100% sure. A pointer to an approach can be found here

Let me know if that helped

Badge +2

Hi Patrick,

Would this work if I don't have the username or email address of the person I'm trying to find in AD, but I have a string var with the First Name + Last Name value? i.e.("Ricardo Gonzalez"). 

I have a document library in SharePoint with a Single Line of Text field called "Owner"; what I'm trying to do is a create a new field named "Document Owner" of type Person and use Nintex to copy the string from Owner and then paste in Document Owner as person value. I need to use a workflow because of the large amount of items in my library. Any advice on how to achieve this?

thanks!

Ricardo

Badge +6

Hi Ricardo Gonzalez,

yes that works for the full name as well - (&(objectClass=user)(displayName={WorkflowVariable:Firstname} {WorkflowVariable:Lastname})) should do the trick. Let me know how you get on.

Thanks,
Pat

Badge +2

Awesome! thanks Patrick, I'll give it a try.

Regards,

Ricardo

Reply