Can I do this with ADWS? - InfoPath Dev
in

InfoPath Dev

Can I do this with ADWS?

Last post 03-12-2012 08:43 AM by ErnestoM. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 02-24-2012 01:58 PM

    • justinr
    • Not Ranked
      Male
    • Joined on 06-09-2011
    • Gainesville, FL
    • Posts 4

    Can I do this with ADWS?

    I've used my GoogleFu, searched around InfopathDev.com, and looked through the ADWS documentation, but was unable to find what I needed, so here goes my first post on the site :)

     I'd like to populate a dropdown with all users that are listed as a Manager in AD, filtered by department selection/input. I imagine the process going something like this:

    •  Drop-down list populated with Departments of the AD users in a specific OU
      • I choose a department
      • Department is set as input for another query
    • 2nd drop-down list is populated with all users in that department, where the Manager AD field = their name

    I think it can be done, I'm just not sure how to go about using the ADWS, UserProfileService, or a combination of both to create this functionality for the form. Can a set of queries be constructed to do this? Thanks for any help in advance :)

    Wandered in, but still havent found my way out of the SharePoint maze
    Twitter - @Jreed637
  • 02-27-2012 12:05 PM In reply to

    Re: Can I do this with ADWS?

    Hi-

    It may be possible using GetAllUsers since it can filter. It's quite an interesting scenario, unfortunately, we don't have any related documentation. I imagine you would:

    1. Call GetAllUsers for a specific OU

    2. This brings in all users with their Departments.

    3. From that result, a list of Departments can be created to populated the dropdown.

    4. When the user selects a department from the dropdown, call a second data connection for GetAllUsers, this time filtered by both OU and department.

    We have a free trial of DBXL available on Qdabra.com, and it includes the Active Directory web service, so perhaps you can get that installed and see if the web service will allow you to accomplish what you require. Come back and let us know how it goes, or whether you run into any issues while trying the above. Good luck!

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 02-27-2012 01:22 PM In reply to

    • justinr
    • Not Ranked
      Male
    • Joined on 06-09-2011
    • Gainesville, FL
    • Posts 4

    Re: Can I do this with ADWS?

    I forgot to mention, I attended the Infopath Master Class in-person this past September, so I've got DBXL and the ADWS already installed :)

    I dragged the data fields for the GetAllUsers datasource to a blank form and tried experimenting with the filter and Max Count query fields. the most I could ever get to show is the first 100 alphabetical names in an OU, which I set as the datasource of a drop-down list just fine. Setting the Max Count query field doesnt change the results. I never could get the Filter query field to work right either; I'm just unsure of the syntax that it's looking for. I tried various things, and when it didnt error out giving me the following response, the results were empty ("Maintenance" Filter was used):

    The query cannot be run for the following DataObject: GetAllUsers
    InfoPath cannot run the specified query.
    The SOAP response indicates that an error occurred on the server:

    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.ArgumentException: The (&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(userAccountControl:1.2.840.113556.1.4.803:=512)(Maintenance)) search filter is invalid.
       at System.DirectoryServices.SearchResultCollection.ResultsEnumerator.MoveNext()
       at System.DirectoryServices.SearchResultCollection.get_InnerList()
       at System.DirectoryServices.SearchResultCollection.get_Count()
       at Qdabra.ActiveDirectory.AdUserInfoImpl.CreateDropDownList(SearchResultCollection results, String listName, String displayPropertyName1, String displayPropertyName2)
       at Qdabra.ActiveDirectory.AdUserInfoImpl.GetAllUsers(String OU, String filter, Int32 maxCount)
       at Qdabra.Dbxl.AdUserInfo.Qdabra.ActiveDirectory.Services.IAdUserInfo.GetAllUsers(String OU, String filter, String maxCount)
       --- End of inner exception stack trace ---

    What is a valid search filter, and how to I get back more than 100 results? 

    One more thing: when I run the query, the only results returned are a Value column with the "User Logon Name" and Display column with the "Display Name" fields from AD. Would I have to feed these results into another query to get the department for each of the users? 

     

    Thanks!

    Wandered in, but still havent found my way out of the SharePoint maze
    Twitter - @Jreed637
  • 03-01-2012 04:55 AM In reply to

    Hi-

    I'm attaching a screenshot of an example of the OU and Filter parameters. Here are some other filter examples:

    1)      Lastname beginning with ‘Ha’
    sn=Ha*

    2)      Users with an email address
    mail=*

    3)      Users with a phone number starting with (425) or (206)
    |(telephoneNumber=\28425\29*)(telephoneNumber=\28206\29*)

    4)      Users with an email and department
    (mail=*)(department=*)

    5)      Users without an email account in AD
    !(mail=*)

    Characters that must be escaped in the filter:
    * = \2A

    ( = \28

    ) = \29

    \ = \5C

    NUL = \00

    To increase the max for the entire installation, in the web.config, make sure the MaxResultItems is increased to handle the maximum you want to allow.

        <qdabra.dbxl>
            <adService path="LDAP://DC=AutonomySystems,DC=local" MaxResultItems="500">

    Save the web.config after the change, then try the query again.

    Hope this helps!


    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


  • 03-09-2012 12:51 PM In reply to

    • justinr
    • Not Ranked
      Male
    • Joined on 06-09-2011
    • Gainesville, FL
    • Posts 4

    Re: Can I do this with ADWS?

    This is exactly what I needed, info on how to use the filter field. I was able to add the MaxResultItems parameter to increase the returned items to 1000 for our environment. I was also able to filter Department=<department name> successfully.

    Another bit of playing around and finding the right AD attribute to query, and I've got it all working. I've setup a drop-down list with the list of our departments which, when changed, feeds the value into a concat statement for the filter: (Department=<ListChoice>)(directReports=*) and queries GetAllUsers. This lets my users chose a department, then the manager from the department, exactly as they desired for the form.

    Thanks for your help and thanks for the AD webservice :)

     

    p.s. - Is there any hard limit to the MaxResultItems parameter other than the time it takes to run the query?

    Wandered in, but still havent found my way out of the SharePoint maze
    Twitter - @Jreed637
  • 03-12-2012 08:43 AM In reply to

    Re: Can I do this with ADWS?

    Glad it's working!

    There are also limits in Active Directory that might restrict how much data will be returned.  But the <httpRuntime executionTimeout=”#seconds” /> and MaxResultItems are the only things that can be controlled in the ADWS.

    http://support.microsoft.com/kb/315071

    Ernesto Machado
    Qdabra® Software/ InfoPathDev.com
    The InfoPath Experts – Streamline data gathering to turn process into knowledge.™


Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.