cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
agaskelluk
Frequent Visitor

Retrieve the samacccountname for a give userid

Dear all

is it possible to retrieve the samaccountname for a given userid using OOTB PowerApps Connectors? When checking the Office365Users or AzureAD Connectors, I do not see samaccountname. The closest is UserPrincipalName which is not what I need.

 

Thanks

Andrew.

4 REPLIES 4
ganeshsanap
Memorable Member
Memorable Member

@agaskelluk 

 

Office 365 User connector does support fetching onPremisesSamAccountName using Get user profile (V2) method.

 

This method returns the properties mentioned at: user resource type - Properties 

 

If this is not working for you then see related workaround (using Power Automate or Graph APIs):

  1. How to populate a SharePoint Online List column with AD User Attributes? 
  2. sAMAccountName attribute in Azure AD 

Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

Hi @ganeshsanap 

I don't see the onPremisesSamAccountName property for UserProfileV2 when I try to call it in my powerapp:

Office365Users.UserProfileV2("test@xyz.com").XXX

 

Perhaps I am doing something wrong. Can you advise?

 

Thanks

Andrew

 

ganeshsanap
Memorable Member
Memorable Member

@agaskelluk 

 

Not sure why but here's what described in documentation: 

 

Power apps - office365 users properties.png

 If this is not working then you can try using MS Graph or Power Automate approach.


Please click Accept as solution & ‌‌👍 if my answer helped you to solve your issue. This will help others to find the correct solution easily. If the answer was useful in other ways, please consider giving it ‌‌👍

agaskelluk
Frequent Visitor

Yes I saw that method listed in the documentation but I cannot access it from intellisense in PowerApps.

Thanks.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (3,366)