Hi all,
I have a Sharepoint list and connected this to Power Automate. One of the steps from this flow is to create a new team (for Teams) and add the user who creates a new item in the Sharepoint list as owner of this new team. Normally one would use the "Created By Email" to achieve this (as in the screenshot below):
This is however not working for our environment because our users are having different primary SMTP email domains which are different then the email logon in Microsoft 365. The flow returns a "unknown user" error. The flow only works if the primary email is the same as the logon email from Microsoft 365.
I hope someone allready fixed this issue.
Many thanks in advance!
Solved! Go to Solution.
Hi @PowerAutomate4,
You only have to amend the expression when your action which is retrieving the e-mail has a different name. That Get Item after outputs refers to the name of the action not the field. The outputs function its format is outputs('Name of action').
Author/Claims is the internal name of the Created by Claims field which is part of the body. So, it shouldn't be necessary to amend the part after the '?'.
From the screenshot it also looks like you directly pasted the code in the value field. Can you paste that code into the expression editor instead?
If you are using the newer expression editor interface it will look like below
When you are using the older expression interface you will probably see something like below.
Hi @PowerAutomate4,
Have you tried the Created by Claims field of the user. That might contain the correct e-mail. I would also use a Get user action to retrieve the AAD ID from Azure Active Directory btw.
Below is an example.
1. Get AD User. Use a split function to only retrieve the e-mail from the claim value.
split(outputs('Get_item')?['body/Author/Claims'], 'membership|')[1]
2. Use Id in the Add a member to team action
Thanks for the fast reply! I tried the "Created by Claims" field already but that doesn't work.
The output is 'i:0#.f|membership|user@domain.tld'
Where user@domain.tld is also not the primary SMTP address. So this email is not good to use in the AAD ID field also.
But I like your solution to get the AAD ID from the "Get user" function. But i don't see this "Get user" function?
Is this possible?
Hi @PowerAutomate4,
Should be part of the Azure AD connector. First look for Azure AD. Select it and look for Get User.
https://docs.microsoft.com/en-us/connectors/azuread/#get-user
Btw, that action requires User Id (which we don't know yet) or the User Principal Name. So, if you know the UPN of your Created By User you could use the Get User to retrieve the correct User Id.
Hi!
I found the function. Thanks!
I did see that the "Created by Claims" email field is good after all. I mistaked here. So this field is usable.
I will give it try and let you know.
Thanks! Appreciate your help!
I have tested your solutions with the "Get User" function but I receive this error:
"message": "Bad Request - Error in query syntax."
I used the 'Created By Claims'" instead of the 'Get_item'
I also get the syntax error when I use your original code.
Hi @PowerAutomate4,
You only have to amend the expression when your action which is retrieving the e-mail has a different name. That Get Item after outputs refers to the name of the action not the field. The outputs function its format is outputs('Name of action').
Author/Claims is the internal name of the Created by Claims field which is part of the body. So, it shouldn't be necessary to amend the part after the '?'.
From the screenshot it also looks like you directly pasted the code in the value field. Can you paste that code into the expression editor instead?
If you are using the newer expression editor interface it will look like below
When you are using the older expression interface you will probably see something like below.
My bad...it works fine. I also found this solution to get the email from the "Created by Claims"
last(split(triggerOutputs()?['body/Author/Claims'],'|'))
Thanks again. Have a nice weekend!
User | Count |
---|---|
16 | |
16 | |
14 | |
9 | |
8 |
User | Count |
---|---|
27 | |
26 | |
24 | |
23 | |
14 |