Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

PLUGIN Sync Microsoft Dynamics CRM with Outlook Address Book

(1) ShareShare
ReportReport
Posted on by 82

5224.tempsnip.png

How can I get the outlook address book group members in order to check if they exists in our system.

I have to create a plugin that will do following things:

For example we have a group 'Test Group' and there are 'Member 1, Member 2, Member 3'.  How can I check if those members exist already as contacts in the CRM.

If the Member 1 doesn't exists we will add him to CRM contacts. 

I've trying this but i get group and principalGroup = null. Could you please explain why?

I've tried to get all groups for current user and the group I've needed wasn't there. 

var allGroups = new GroupPrincipal(principalContext, "*");
PrincipalSearcher ps = new PrincipalSearcher(allGroups);

It seem that there aren't any group from outlook address book.

Does anyone know the reason? 

private void GetUsers()
{
   using (var principalContext = new PrincipalContext(ContextType.Domain))
     {

        var users = getAllExistingUsers();
        foreach (var user in users.Entities)
        {
               UserPrincipal userPrincipal = UserPrincipal.FindByIdentity(principalContext, IdentityType.SamAccountName, login);

               if (userPrincipal != null)
                  {
                     var groupPrincipal = GroupPrincipal.FindByIdentity(principalContext, IdentityType.Name, "Test Group");
                     DirectoryEntry de = userPrincipal.GetUnderlyingObject() as DirectoryEntry;
                     var groups = de.Properties["memberof"].Value;
                  }

           }
   }
using (var group = GroupPrincipal.FindByIdentity(principalContext,IdentityType.Name, "Test Group"))
{
      if (group != null)
      {
        foreach(Principal p in group.GetMembers())
           { 
             var userId = p.Guid;
           }
       }
   }
}

}

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,407 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans