Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Outlook
    • Planner
    • Power Apps
    • SharePoint
    • Teams
  • Triggers
  • Ready to use solutions
    • Approval Process Template
    • Task Delegation App
    • The Ultimate Power Automate expressions cheat sheet
    • Power Automate HTTP requests to SharePoint cheat sheet
    • Power Automate HTTP requests to Graph API cheat sheet
  • ABOUT ME
  • Get help with your flow
  • POWER PLATFORM SERVICES
Menu

Make sure user(s) exist on SharePoint site with Power Automate

Posted on January 14, 2024February 4, 2024 by Tom

“I’m trying to update SharePoint people picker field using user id, but the Power Automate http request keeps telling me the no user doesn’t exist!”


If you’re like me and use a lot of http requests to SharePoint, you might find that working with users can be sometimes challenging. It’s because of the variety for these requests. Sometime you need just the user email, other time you need the whole claims login, or even the SP site principal id. While email is something you always have and can use to build claims login, with the principal id it’s not that simple.

What’s SharePoint principal id

Principal id is an id assigned to a user on a specific SharePoint site. It’s not a fixed guid, as the user id in Entra AD, but it varies between sites. Once the user visits a site, or you use him anywhere on the site, he’ll receive the id. That means one user can have a different principal id on each SharePoint site in your organisation.

This id is then used when managing permissions via http requests, or when creating items in a SharePoint list, let it be a single item or a batch import.

How to assign the principal id

As you can see above, you need an http request to get this id. Yet there’s no id to get if the users doesn’t have one on the site. Trying to get id of such user will stuck the flow.

Therefore, if you’re not sure whether the user exists, it might be a good idea to do some preparations. By that I mean adding another http request to create this id (if it doesn’t exist yet).

Method: POST

Uri: _api/web/ensureUser

Header:
{
  "accept": "application/json;odata=verbose",
  "content-type": "application/json;odata=verbose"
}

Body:
{
    "logonName": "<user email address>"
}

Note: <…> is a placeholder, replace it including the < and >.

Power Automate user exist SharePoint

After this request you can be sure that the user has a principal id. Get it and use wherever you need.

Power Automate user exist SharePoint

Summary

You probably won’t need the user principal id very often, but if you’re using a lot of http requests to SharePoint in your Power Automate flows, it’s good to know they exist. It’s a special user id, a different number on each SP site, assigned only when needed. Which can be a problem if your flow is the first one who needs that. Yet as many times before, if you’re not sure, there’s an http request to help you deal with these situations.


πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

πŸš€ Master Power Automate

Join 2,000+ professionals getting actionable Power Automate tutorials, solutions, cheat sheets & tips every week.

No spam. Unsubscribe anytime.

Still exchanging emails to get things approved?

Use the Approval Process Template and the Task Delegation App to skip the hard part and deploy an automated, fully functional approval solution on a SharePoint list in minutes! And then the next one, and the next one...

Approval Template Preview ✨ Learn more ✨

Turn ideas into flows with ease!

Grab the complete Power Automate Cheat Sheet Bundleβ€”everything you need to master expressions, SharePoint HTTP calls, and Graph API in Power Automate.

Cheat Sheet Bundle Preview ✨ Get the Cheat Sheets

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with thousands of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2025 Let's POWER Automate | Theme by SuperbThemes