Hello
I am trying to build an app that gets the Office 365 Users Profiles and Write them in a Sharepoint List, however the Manager field must be a LookUp field getting the managers from the same List. In order to do this I was thinking to run the app twice, first to get all the users and then to identify the managers and write the lookup field.
I was already helped by @RandyHayes here but I am blocked in something:
This delegation warning, I think I will have problems was the users can be more than 2000.
Patch(Org,
ForAll(Filter(Office365Users.SearchUserV2().value, AccountEnabled=true),
With({_rec: LookUp(Org, MailColumn = Mail)},
{
ID: _rec.ID,
Title: DisplayName,
MailColumn: Mail,
JobTitleColumn: JobTitle,
DepartmentColumn: Department,
Manager: With(LookUp(Org, MailColumn = Office365Users.Manager(Id).Mail), {Id: ID, Value: Title})
}
)
)
Solved! Go to Solution.
Hi @Mamacona ,
No - you will not get more than 2,000 items at once either in a collection of using With().
Hi @Mamacona ,
I cannot test this (so you may also get a warning here), but try
With(
{
wUsers:
Filter(
Office365Users.SearchUserV2().value,
AccountEnabled
)
},
Patch(
Org,
ForAll(
wUsers As aPatch,
{
ID: aPatch._rec.ID,
Title: aPatch.DisplayName,
MailColumn: aPatch.Mail,
JobTitleColumn: aPatch.JobTitle,
DepartmentColumn: aPatch.Department,
Manager:
{
With(
{
wMan:
LookUp(
Org,
MailColumn = Office365Users.Manager(Id).Mail
),
{
Id: wMan.ID,
Value: wMan.Title
}
)
)
}
}
)
)
)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
What is _rec.ID ? I was simply using your values, which I assumed were valid.
@WarrenBelz Yes they are
Look here
With({_rec: LookUp(Org, MailColumn = Mail)},
It was mentioned there to read the store the ID.
What i am trying to do is a button that when i press it, gets all the users with some attributes from Office 365 Users and writes this into a SharePoint List. At the same time this writes a Lookup as Manager, this manager is taken from the same List. The problem is that, there are more than 2000 values and it is too much for it 😞
Hi @Mamacona
I missed that bit at the top
With(
{
wUsers:
Filter(
Office365Users.SearchUserV2().value,
AccountEnabled
),
_recID:
LookUp(
Org,
MailColumn = Mail
).ID
},
Patch(
Org,
ForAll(
wUsers As aPatch,
{
ID: _recID,
Title: aPatch.DisplayName,
MailColumn: aPatch.Mail,
JobTitleColumn: aPatch.JobTitle,
DepartmentColumn: aPatch.Department,
Manager:
{
With(
{
wMan:
LookUp(
Org,
MailColumn = Office365Users.Manager(Id).Mail
),
{
Id: wMan.ID,
Value: wMan.Title
}
}
)
}
}
)
)
)
however, whatever you do here, you will be limited to 2,000 records in the output of the top statement (or however else you try to collect the users).
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Thank you! but actually I was looking for a way to overcome this limitation :(, there is a way to do it?
Hi @Mamacona ,
No - you will not get more than 2,000 items at once either in a collection of using With().
User | Count |
---|---|
256 | |
111 | |
95 | |
48 | |
40 |