This project has moved. For the latest updates, please go here.

Customize LDAPCP to add additional LDAP connections

Mar 19, 2014 at 3:39 PM

First off - LDAPCP is fantastic! Thank you for your efforts for delivering this solution out to the community.

I noticed that we need to use "LDAPCP for developers" to modify it for additional LDAP connections. Unfortunately I'm not a developer by any stretch of the imagination. I was wondering if you could provide some guidance as to help me add these modifications.

I am using VS 2012 Update 4. Unfortunately, when I try to open the project file "Developers.csproj", I receive and error: "Unsupported:This version of Visual Studio does not have the following project types install or does not support them. "

I thought by installing the "Service App Starter Kit (VS2012)" project template would fix this error but that's not the case.

Would someone please help me get started?

Thank you so much!
Mar 19, 2014 at 8:53 PM
First of all thank you so much for such a great project. Really appreciate your effort on this.

I am also running into the same problem as Brian. I am not developer and was looking for some high level step by step to add the second Domain Controller.

I have downloaded the solution for developers and I can see SetLDAPConnections and I have updated the code to search my local DC and remote DC. Do I simply compile the code and deploy the solution package? When installing do I need to change the Claim provider name to LDAPCP_Custom?

Sorry for the noob questions.

Thank you for your help.
Mar 19, 2014 at 9:22 PM
Edited Mar 19, 2014 at 9:25 PM
OK - I got the project to load in VS.

At this point, would I just edit the protected override DirectoryEntry[] method in "LDAPCP_Custom.CS" and simply Build the project, and then just install LDAPCP Custom.wsp?

Appreciate any advice. Thank you.


Didn't see your post Sean. I am at the exact same spot and looking for the same guidance.
Mar 20, 2014 at 9:54 AM

first thanks a lot for your feedback :)

The project is created with Visual Studio 2013, but it should be fine to open it with an earlier version (I didn't test).
However it is important to open it on a box that has SharePoint installed, otherwise Visual Studio may generate errors.

Regarding your customization, yes it's normally as simple as that, but SharePoint development is not easy, especially when you have little development skills, and it can take you to issues very difficult to understand. You should especially be careful when you deploy an update of the solution.
My advice: do not hit F5 in Visual Studio to deploy solution automatically. Instead, generate the .wsp file and update solution using Update-SPSolution cmdlet (like I document in the homepage) and the do an IISRESET.
It's not the shortest way, but it is the most safe I can recommend :)

Mar 21, 2014 at 4:10 PM
Thank Yvan. That response has helped me to get it to work.

One thing I liked about LDAPCP is that in the Gobal configuration, you can select "always use a specific LDAP attribute for the display text."

Where can I apply this functionality in your sample class?

Also, is it possible to only have the Display Text set on the permission - it appears your code attaches the identity claim in brackets with the display name next to it.

Thank you so much for your help.
Mar 25, 2014 at 6:31 PM
Hi Yvan,

Was wondering if you were able to take a look at my request above.

To explain by example, I find that whenever I add a user by email, in the people picker, the permission is displayed as "Joe Smith (" It would be great if it would be able possible to display the permission as just "Joe Smith"

I'm finding the same whenever I add a group - the text "(Role)" is displayed next to my group name in the people picker.

Thank you again.
Mar 26, 2014 at 1:17 PM
Edited Mar 26, 2014 at 1:17 PM

sorry for my late reply, yes this can be done easily when you override the method PopulateAttributesDefinition:
For each AttributeHelper object you create in the list, you can set property LDAPAttributeToDisplay to specify which LDAP attribute it will display for the current claim type.

To use your email example above, AttributeHelper object would look like this:
new AttributeHelper{LDAPAttributeName="mail", LDAPObjectClass="user", claimType=nsmsclaims.ClaimTypes.Email, claimEntityType = SPClaimEntityTypes.User, peopleEditorEntityDataKey=PeopleEditorEntityDataKeys.Email, LDAPAttributeToDisplay="displayName"},

Let me know if it's not clear.
Mar 28, 2014 at 9:24 PM
Thank You Yvand. That's what I had in code but unfortunately it doesn't quite work... but that's okay, I think we'll be fine. Like I said, whenever I add a user by email, in the people picker, the permission is displayed as "Joe Smith (". Would be nice if the the display text only displayed "Joe Smith" and not the email in brackets with it.

If it's not possible, that okay. Anyways, thank you for your help, and again, thank you for this great solution!
Apr 7, 2014 at 12:07 PM
hello, sorry for my late reply.
It's very easy, you just need to set property "DisplayLdapMatchForIdentityClaimType" to false in method SetCustomSettings()
Marked as answer by Yvand on 4/9/2014 at 7:51 AM
Apr 9, 2014 at 2:18 PM
Thanks Yvand! That worked!