How to build a SharePoint phone book using Active Directory in 10 minutes?


The Layer2 Business Data List Connector for SharePoint solves many issues that still exist with the SharePoint out-of-the-box external data integration. It makes it as easy as possible to connect native SharePoint lists to almost any external data sources, codeless and bi-directional. All native SharePoint list features are available for the connected lists, including search, managed metadata, offline and mobile access, change notifications and workflows. This use case shows how to connect a native SharePoint list with an Active Directory query result set. 



A company phone book application is part of nearly every SharePoint portal. With BDLC you can build it in just minutes. Simply connect a native SharePoint list directly to an Active Directory LDAP query. The results are cached in the list and updated regulary. You can use all list features, e.g. views, search, attachments, change notifications, workflows to improve your application.


how to sharepoint phonebook active directoy 0

Fig. Create a new custom list, goto list settings and click "Connect to external data source"



how to sharepoint phonebook active directoy 3

Fig.: Connect the list with an Active Directory query result via LDAP (or any other provider). You can hide the connection string in the SharePoint Secure Store, if required.



how to sharepoint phonebook active directoy 1

Fig.: After update you have a native list with your Active Directory data query results. Please customize the view, try search when indexed. The list is kept current automatically in background, if enabled.



Please note:


  • Select the OLEDB Provider to connect to AD via LDAP. The LDAP driver is already installed.
  • You can use the following connection string: Provider=ADSDSOOBject; User Id=MyDomain\myUser;Password=myPWD;Mode=Read;Bind Flags=0;Page Size=1000;
  • Please validate connection.
  • 1000 items is the max page size of the LDAP driver. You can use Ntdsutil.exe to increase:
  • ​You can use a select statement like this:
    SELECT Statement: SELECT title, name, ADSPath, givenName, cn, co, company, department, description, displayName, l, mail, mobile, physicalDeliveryOfficeName, postalCode, sAMAccountName, sn, st, streetAddress, telephoneNumber From 'LDAP://myServer.myDomain.local/DC=myDomain,DC=com' WHERE objectClass='user' AND objectCategory='Person'
  • Please validate query.
  • If you have issues, please start with a high privilaged account and a very simple query, e.g. name only.
  • Please preview results.
  • Please enter ADSPath as primary key, or use any other field, that is unique in your query.
  • Add columns (that creates the list structure for your query result set). You can modify the column type later on.
  • Use "check mapping" to check, that all list columns are mapped to query fields.
  • Press update. There should be something like "xxx items inserted".
  • Press update again. There should be no changes if you have selected a valid primary key.
  • Enable "Background Update" to sync every hour or setup other interval (see documentation).
  • Close and switch to the list.
  • Upps ... 10 minutes are over ;-)
  • You can change some column titles for better user experience, no problems with updates. Create views if required, e.g. grouping by department etc. Use general search or customize as usual with SharePoint.
  • You can add a calculated column to link or display an photo of the person etc. You can add attachments and other additional "SharePoint only" columns. It will be kept while updating (if your primary key works).
  • You can subscribe to changes with email or RSS notifications, start workflows on data change.
  • You can take offline using Microsoft Outlook.


Known issues and workarounds:


  • Error reading from entity 'Active Directory: 'ADSDSOObject' failed with no error message available, result code: -2147016669(0x80072023).
    The message directly comes from the Microsoft ADS data provider / driver, not product related. You can google for specific reasons. You may also want to consider changing MaxPageSize in Active Directory using ntdsutil.exe. See How to view and set LDAP policy in Active Directory by using Ntdsutil.exe for more details.
    Please also set Page Size Parameter in connection string, e.g. …; Page Size=1000; …
  • The SQL supported by the Microsoft-based data provider is very specific. This is a known issue and not Layer2 product-related. You can find query samples in the internet via Google. In case of where conditions don't use "myField IS NOT NULL" or myField != ''. MyField = '*' could help.


As a next step please register and download the Layer2 Business Data List Connector for SharePoint (free Shareware Edition) or consult any local reseller and implementation partner (see right margin).


Layer2 leading solutions product regsitration icon: a grey square with a big orange pen symbol.

Register for free download.

Keep your Sharepoint in sync. Download and try today.

Contact Us Icon for Layer2 leading solutions

Questions? Contact us.

We are here to help. Contact us and our consulting will be happy to answer your questions.