My goal is to be able to search for specific contact in Microsoft 365 People and return the contact id. This would give me the ability to push updates to the exact contact record in my Microsoft 365 contacts.
I currently do not know of a way to push that contact id back from Microsoft to my CRM where I could store the contact id and use for future contact record updates.
This is why I am looking for the ability to search for the contact in the Microsoft 365 People Module search function. I am using the DisplayName as the unique identifier. The Microsoft documentation states that this field is searchable and indexed.
From my CRM I am using a Webhook Post to pass in all fields for the contact record. On the receiving webhook I am able to see all of the data I am passing. This works great. In the next step I am using the search contact’s function and passing in the DisplayName. The contacts I am searching are stored in a specific contact folder and that folder is set from the Scenarios UI. In the Query I am using is as follows:
DisplayName “first_name last_name”
These fields are selected from the available webhook fields passed in through the webhook.
When I look at the query input, I can see that the correct name / values are being passed in. The output side is a different story. I Intentionally sent over a name / value that would NOT be in the contact folder. I expected to have no records found in the output. Instead, the query returns all the available contacts in the folder.
Am I not understanding how to use the use the Search Contacts function? Or am I missing a step to filter my output results? Below is a screen shot of the contact search showing the input query with the correct Display Name to search for and the output results showing an unrelated contact record.
~~~~~~~~~~~~~~~~UPDATE~~~~~~~~~~~~~~~~~~
I have discovered that I misunderstood how the search query works. I am used to defining the
field to search within to find the results I am looking for. This function apparently does not
work like that. Rather it searches every record in the specified folder. You only need to add the
text you're looking for or use a variable passed in by the webhook. (See image below)
![2024-01-17_18-08-53|441x500](upload://1Vs6x0QmQKeRGELqxs5qH1FTUqE.png)
Now that I have figured that out, I have created a scenario that will handle several scenarios.
(Pun intended)
1. Create new contact
2. Update existing contact
3. Create Contacts Previously existing in the CRM and not in outlook.
4. Handle contacts that only have a phone number and not an email address.
5. Handle contacts that only have an email address and not a phone number.
(See image below)
![Screenshot 2024-01-17 181948|435x282](upload://h57UfeC1tEaZgbjzu4le9iy5LVU.png)