cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mandi-parker
Advocate I
Advocate I

Office365Users.MyProfileV2('$select:'

I have an app that needs the employeeId field from Azure AD.  I've set up a flow and passed the employeeId back to PowerApps, but I was hoping to find a way to do it with a direct connection from PowerApps.  I've found documentation on the Office365 Users connection that says that you can select additional fields outside of the default ( https://docs.microsoft.com/en-us/connectors/office365users/).  IntelliSense gives a {'$select': option on Office365Users.MyProfileV2().

I've created a button to do the following:

Set(varUserV2Select,Office365Users.MyProfileV2({'$select':"userPrincipalName,employeeId,displayName,mail,mailNickname"}))

I can still only get to all of the default fields.  I can't figure out how to get to employeeId.  Is this even possible, or am I reading too much into the documentation?

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@mandi-parker 

Yes...reading a little too much into the documentation!

Although you can pass the fields that you want to return, you can still only access the values that there are properties for on the GraphUser object that is returned.  If there was an employeeId property on that, then it would work, but there is, sadly enough, none at this time.

 

Not the answer you expected perhaps, but I hope it helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

6 REPLIES 6
RandyHayes
Super User
Super User

@mandi-parker 

Yes...reading a little too much into the documentation!

Although you can pass the fields that you want to return, you can still only access the values that there are properties for on the GraphUser object that is returned.  If there was an employeeId property on that, then it would work, but there is, sadly enough, none at this time.

 

Not the answer you expected perhaps, but I hope it helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

Thank you, @RandyHayes 

 

So select is a way to limit the data returned and not to get to additional fields available through the Graph API for Get User, then.  Does anyone have any other ways to get to this other than going through flow?  Custom connection to Graph API through PowerApps?  Thanks!

 

@mandi-parker 

Yes, you can do a custom connector.  I've done that in the past to get around the issue. But, it is a custom connector (mind you license) and it does require some steps to put in place.

However...word on the street is that PowerApps will soon be able to access the Graph API more completely - this is purely anecdotal based on a conversation from Build this year, I cannot confirm it.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
indhaa
Impactful Individual
Impactful Individual

@RandyHayes Any change to this. I can see employeeID on the documentation but don't know how to retrieve it.

 

@indhaa Currently (As of 2021-09-27), there is no Out of the box connector for Power Apps that will get you employeeId. The reason is that we need to query the beta version of Microsoft Graph, as it is not query-able in the version 1.0 of the endpoint. There is hope, the new Office 365 Users Connector has a new version of Get my profile (V2) that queries the new version of the Graph interface, and allows us to select employeeId, as well as almost everything else available. The downside is that it returns a GraphUser_V1 object. So, even though the API call has the capability to return the employeeId, since Power Apps is Strongly Typed, we cannot reference employeeId as it's not a part of the GraphUser_V1 object.

 

Power Apps may not be able to pull the value, but Power Automate can. As a POC to get you started:

  1. In Power Apps, create a button with the Action being running a Power Automate Flow.
  2. Create a new flow "Power Apps button" called "GetEmployeeId".
  3. In Power Automate, create a new step: Get my profile (V2).
    • Under advanced options set Select fields to employeeId
  4. Create a new step: Parse JSON
    • Set Content to the body of Get my profile (V2): @{outputs('Get_my_profile_(V2)')?['body']}
    • Set Schema to:
{
    "type": "object",
    "properties": {
        "@@odata.context": {
            "type": "string"
        },
        "@@odata.id": {
            "type": "string"
        },
        "employeeId": {
            "type": "string"
        }
    }
}
  1. Create a new step: Respond to a PowerApp or flow
  2. Add an output type Text:
    • Enter title : EmployeeId
    • Enter in a value to respond : @body('Parse_JSON')?['employeeId']
  3. Save the Power Automate flow and test it. You will have to approve O365 access permissions. The whole flow should look like this:
 
 

 

  1. Back in Power Apps, Connect your new flow to the app.
  2. Set your Button1.OnSelect to: Set( varEmployeeID, GetEmployeeId.Run())
  3. Create a label with the Label1.Text set to: varEmployeeID.employeeid
  4. Run the app and click the button to test.
indhaa
Impactful Individual
Impactful Individual

Hi,

 

Thanks for the reply. I have already done this on my App.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,182)