Answered by:
Get users information form Active Directory

Question
-
I have a page for selfservice.aspx where I can upload a picture for myself and the name field is showing the current user which is developed by c# (WindowsIdentity.GetCurrent Method ())
How can I get the name of other users from Active Directory like people picker for example so I can upload a picture for others.Thank You!
Thursday, May 12, 2016 1:51 PM
Answers
-
Hi MGHA,
The articles below are about how to get active directory users programmatically, you could refer to.
Getting Active Directory UserId from Windows Claim in SharePoint 2013.
Get List of Active Directory Users in C#.
http://www.codeproject.com/Tips/599697/Get-list-of-Active-Directory-users-in-Csharp
Get Active Directory Groups and Users programmatically.
https://naimmurati.wordpress.com/2012/03/13/get-active-directory-groups-and-users-programmatically/
Best regards,
Sara Fan
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Victoria Xia Friday, May 20, 2016 9:15 AM
- Marked as answer by Victoria Xia Friday, June 3, 2016 10:25 AM
Friday, May 13, 2016 7:37 AM
All replies
-
don't touch AD directly.
Use the user profile service and surrounding components (people picker, etc).
don't use WindowsIdentity either... use SPContext.Current.User... what happens if the user comes from an FBA membership? the built-in components know how to handle these things... your assumptions about WindowsIdentity won't likely cover all current use cases, and certainly won't cover future use cases... Microsoft ensures that the components do.
Scott Brickey
MCTS, MCPD, MCITP
www.sbrickey.com
Strategic Data Systems - for all your SharePoint needsThursday, May 12, 2016 2:55 PM -
Hi MGHA,
The articles below are about how to get active directory users programmatically, you could refer to.
Getting Active Directory UserId from Windows Claim in SharePoint 2013.
Get List of Active Directory Users in C#.
http://www.codeproject.com/Tips/599697/Get-list-of-Active-Directory-users-in-Csharp
Get Active Directory Groups and Users programmatically.
https://naimmurati.wordpress.com/2012/03/13/get-active-directory-groups-and-users-programmatically/
Best regards,
Sara Fan
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.- Proposed as answer by Victoria Xia Friday, May 20, 2016 9:15 AM
- Marked as answer by Victoria Xia Friday, June 3, 2016 10:25 AM
Friday, May 13, 2016 7:37 AM