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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,524)