Notifications
Announcements
Hi,
How to create a collection to retrieve all the departments from the office365user connector in a comobox?
and using Distinct to get only the unique values and sort them using the Sort command.
Gr.P
hey @PeKi72
you can try this:
// Replace 'YourCollectionName' with the name you want to give to your collection ClearCollect(YourCollectionName, Office365Users.SearchUser({searchTerm: "", top: 999}).department); ClearCollect(SortedUniqueDepartments, Sort(Distinct(YourCollectionName, Value), Result, Ascending));
Set its Items property to the collection that holds the sorted and unique departments, which is SortedUniqueDepartments in this example:
SortedUniqueDepartments
Let me know if my answer helped solving your issue.If it did please accept as solution and give it a thumbs up so we can help others in the community.Greetings
Where should i put the ClearCollect sentences?
I would like to leave the name YourCollectionName as it is. But i get an error !
Gr. P
Try this code
ClearCollect( YourCollectionName, Office365Users.SearchUser({searchTerm:"",top:999})); ClearCollect( DepartmentCollection, YourCollectionName.Department ); ClearCollect( SortedUniqueDepartments,Sort(Distinct(DepartmentCollection,Department),Value))
what does the error say?
The problem is i do not know how to create a collection or am i even aloud to create a collection. Even as simple as this below i get an error:
P
Frustrating 😫
Found the error: the comma should be ;
Now the only thing i need is to get the Department values of the Office365users connector into that Collection.
Which i have declared in the OnStart event of the app
put the curser on the red underlined collection name and show me what the error says
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
In our never-ending quest to improve we are simplifying the forum hierarchy…
We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
WarrenBelz 765 Most Valuable Professional
Michael E. Gernaey 343 Super User 2025 Season 2
Power Platform 1919 272