cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
baarsd
Helper I
Helper I

Collecting all users from Microsoft365users

Hi all,

I'm trying to add all users from the Microsoft365users connector to a collection (as the default search ability of the connector doesn't search what we want).


When I do e.g. this

 

 

 

ClearCollect(
    AllUsers,
    Microsoft365Users.SearchUserV2({top:1000})
);

 

 

 

The collection is not what I expected, instead it has two columns 

@odata.nextLink
value

pic1.jpg

 

 

when I browse into "value" it shows what I was originally expecting

pic2.jpg

 

How can I get the collection to just show as the columns in "value" instead of the "@odata.nextLink, value" columns?


Thanks!
Dylan

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @baarsd ,

Do you want to the 'searchTerm' to be applied to company-only users?

 

If you want to search company-only users using the Microsoft365Users.SearchUserV2() function through the 'searchTerm' attribute, I afraid that there is no way to achieve your needs currently.

 

Currently, the 'searchTerm' attribute in Microsoft365Users.SearchUserV2() function is only applied display name, given name, surname, mail, mail nickname and user principal name. Please check the following article for more details:

https://docs.microsoft.com/en-us/connectors/office365users/#search-for-users-(v2)

 

If you would like this feature to be added in Microsoft365Users.SearchUserV2() function, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

As an possible solution, just as I mentioned above, you could consider create a custom connector based on Microsoft Graph REST API, then you could define a action in your custom connector along with the search query parameters.

https://docs.microsoft.com/en-us/graph/query-parameters#odata-system-query-options

 

Regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
baarsd
Helper I
Helper I

OK so I fix that up with

Clear(AllUsers);

ForAll(
    Temp,
    Collect(
        AllUsers,
        value
    ))

however the searchUserv2 appears to only ever return 1000 users - is there a way to increase this number or to use searchTerm to search for all? 

Hi @baarsd ,

Regarding your original issue, please also consider try the following formula:

ClearCollect(
              AllUsers,
              Microsoft365Users.SearchUserV2({top:1000}).value
);

 

For your second question, do you want to retrieve more than 1000 users using your Microsoft365Users.SearchUserV2 function? I afraid that there is no way to achieve your needs in PowerApps currently, it is an known limit with the Microsoft365Users connector.

 

As possible solution, I think a customer connector could achieve your needs. You could consider create a custom connector based on Microsoft Graph REST API, then define a List users action in this custom connector to retrieve all users in your tenant. Then within your canvas app, you could create a connection to this custom connector, and then use the custom connector action to retrieve users from your tenant.

 

More details about creating a custom connector using Microsoft Graph API, please check the following blog:

https://gotoguy.blog/2017/12/17/access-microsoft-graph-api-using-custom-connector-in-powerapps-and-f...

 

Regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi, thanks for your response! Re: searching, is it possible to use searchTerm to search for company-only users? AAD and the SearchUser command in PowerApps returns guests, online (cloud) users, AD-synced users, resource mailboxes...etc. I just want it to return AD-synced users.

Hi @baarsd ,

Do you want to the 'searchTerm' to be applied to company-only users?

 

If you want to search company-only users using the Microsoft365Users.SearchUserV2() function through the 'searchTerm' attribute, I afraid that there is no way to achieve your needs currently.

 

Currently, the 'searchTerm' attribute in Microsoft365Users.SearchUserV2() function is only applied display name, given name, surname, mail, mail nickname and user principal name. Please check the following article for more details:

https://docs.microsoft.com/en-us/connectors/office365users/#search-for-users-(v2)

 

If you would like this feature to be added in Microsoft365Users.SearchUserV2() function, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/Power-Apps-Ideas/idb-p/PowerAppsIdeas

 

As an possible solution, just as I mentioned above, you could consider create a custom connector based on Microsoft Graph REST API, then you could define a action in your custom connector along with the search query parameters.

https://docs.microsoft.com/en-us/graph/query-parameters#odata-system-query-options

 

Regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.

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,324)