Asked by:
Adding Pictures to Active Directory and Show in CRM 2013

Question
-
Hi All
i upload our organization users picture in active directory and i can see all of the user picture profiles in lync outlook and other products but crm 2013 don't show user's profile picture please help me
Tuesday, January 27, 2015 10:11 AM
All replies
-
Hi,
Dynamics CRM stores the user picture in the entityimage field and there isn't an automatic synchronization to fetch them from Active Directory.You need to write some custom code if you want to synchronize the picture of the users
My blog: www.crmanswers.net - Rockstar 365 Profile
- Proposed as answer by Vasu100ind Wednesday, January 28, 2015 5:04 AM
Tuesday, January 27, 2015 10:15 AM -
thanks a lot can you help me i write this code or have you a sample code ?Tuesday, January 27, 2015 10:21 AM
-
Code to retrieve the picture from Active Directory:
Code to set the picture inside CRM:
https://msdn.microsoft.com/en-us/library/dn511697.aspx
My blog: www.crmanswers.net - Rockstar 365 Profile
Tuesday, January 27, 2015 10:26 AM -
Hi,
You can use the below code to update crm entity image from AD.
var directoryEntry = new DirectoryEntry("LDAP://" + domain, adminusername, adminpassword); var directorySearcher = new DirectorySearcher(directoryEntry); directorySearcher.Filter = string.Format("(&(SAMAccountName={0}))", updateduserdomainname); var user = directorySearcher.FindOne(); int count = ((System.Collections.ReadOnlyCollectionBase)(user.Properties["thumbnailPhoto"])).Count; if (count > 0) { var bytes = user.Properties["thumbnailPhoto"][0] as byte[]; Entity updateentity = new Entity("your entity name"); updateentity.Id = "entityid"; updateentity["entityimage"] = bytes; service.Update(updateentity); }
If you find this post helpful then please Vote as Helpful and Mark As Answer. Thanks and Regards, Polat Aydın My blog
Tuesday, January 27, 2015 12:15 PM