In this Power Automate tutorial, we will see how we can fix the error ‘The user does not exist or is not unique’ in Power Automate.
Recently, when we were trying to add members to an existing Communication site using Power Automate, we came across an error. This error states that the user does not exist or is not unique in Power Automate.
You can see the screenshot below:
So, in this Power Automate tutorial, we will discuss the solution of how the solve the error when the user does not exist or is not unique.
The user does not exist or is not unique error in Power Automate
Here, we were having an existing communication site in SharePoint named “HR Hub“. Now, we were using Power Automate to add members to this existing SharePoint site.
For the execution of this task in Power Automate, we first need to fetch the member group id of the communication site.
Once we get the group id, we will then parse the JSON output that will reflect in the dynamic content. After this, we will use the member group id to add members to this particular site.
Here are the steps that we followed in Power Automate:
Step-1: Click on +New step and select ‘Send an HTTP request to SharePoint‘. Next, add the below information:
- Site address: Select the site URL from the dynamic content
- Method: Select the GET method, because we are fetching the group id from the site
- Uri: Provide the “_api/web?$select=AssociatedMemberGroup/Id&$expand=AssociatedMemberGroup” , to get the group id
- Headers: Provide the headers like the ones below, which are required to do the rest API calls.
{
"Accept": "application/json;odata=nometadata"
}
Step-2: Again, click on +New step and select Parse json action, then provide the below information:
- Content: Select the Body from the dynamic content, from the previous step.
- Schema: To get the schema, click on ‘Generate from sample‘, and then provide the json code of the output of the above step.
{
"AssociatedMemberGroup": {
"Id": 5
}
}
Step-3: This is the main step where we will add members to the SharePoint site. So click on the +New step and then select Send an HTTP request to SharePoint action. After this, add the following data:
- Site address: Select the Site URL from the dynamic content.
- Method: Select the POST method, as we are adding members to the SharePoint site.
- Uri: Provide the API as ‘/api/web/sitegroups/getById(@{body(‘Parse_JSON-_Group_Id_3′)?[‘AssociatedMemberGroup’]?[‘Id’]})/users’ , to add the members to the SharePoint site.
- Headers: Provide the headers like below, to do the rest API call we need Accept and content-type.
{
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
}
- Body: In the body, provide the below json code to add a member to the SharePoint site.
{
"__metadata": {
"type": "SP.User"
},
"LoginName": "<provide the member email>"
}
However, when we were running this flow, we came across this error- ‘The user does not exist or is not unique‘ error in Power Automate. You can also refer to the image given below for a detailed error message.
Now, in the next section, we will see how to resolve this error in Poer Automate.
‘The user does not exist or is not unique’ error in Power Automate – Solution
Here first let us understand why we face this error ‘The user does not exist or is not unique’ in Power Automate.
Now, if you look closely at Step-3 we specified ‘LoginName’ in the previous section, we specified the Body as the following:
{
"__metadata": {
"type": "SP.User"
},
"LoginName": "<provide the member email>"
}
Here for this LoginName, we directly specified the member email id. However, this method in Power Automate is not correct. Instead, we need to specify the LoginName field as given below.
{
"__metadata": {
"type": "SP.User"
},
"LoginName": "i:0#.f|membership|<provide the member email>"
}
So, before mentioning the member’s email address, we also need to specify i:0#.f|membership|. This string before the email address is used to indicate the login name in SharePoint. Which is used for user authentication.
This is how we can fix the error ‘The user does not exist or is not unique’
Conclusion
In this Power Automate tutorial, we saw how we fix the error ‘The user does not exist or is not unique’ in Power Automate.
You may also like:
- Remove unwanted properties from an object using Power Automate
- Power Automate Exception handling using Try Catch Block
- Power Automate which exceeds the maximum nesting limit of ‘8’
- attempted to perform an unauthorized operation. power automate error
I am Bijay a Microsoft MVP (10 times – My MVP Profile) in SharePoint and have more than 17 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com