cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Bamboulete
Regular Visitor

Update SharePoint List Items is so horrible slow

Hallo,

 

i had read a lot of posts but didnt find a good one, what helped me by my problem.
My Situation:
I have a powershell skript that takes all our onprem active directory users with some specific properties and fill them into a sharepoint list.
The creation from the powershell skript needs for our 3.500 Users (3.500 SP Elements) like 1H. (With: foreach -> item -> Add-PnPListItem)

We have also a powerapp what is connected to the SP list.
The app is a gallerylist with max. 100 elements per user of the app.
In this app, we want to update elements through a button with a patch method, but it needs 1-6 seconds to update each element.
When a user click the button on the first element and than fast on the second element, the app is becoming more slower and its loading.

My Question:
1. Is there a way to update one property of a sharepoint list item through a powerapp button in real time?
2. Is there a way to get 3.500 elements at once added to a sharepoint list in a couple of seconds, rather than a hour in my situation?

Thanks for your help!!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Bamboulete 

Yes, this is a good source of slowness.

 

So, I work with very large SharePoint lists quite often (in fact working on one with over 900k records right now).  There are a lot of factors that go into getting the performance "acceptable" - and bear in mind, there will always be slowness possible (even with small lists), it is the nature of the technology.

 

For most of the time for a gallery, I will pre-filter large lists into app memory in a variable.  This is static though and will not change when records are changed via patch.  

If you want to simulate the two, then you need to instead enlist a collection (as it is a table variable that you can add/remove/edit records in).  Then your Patch would not only patch the data source, but a second patch to the collection is needed to reflect the changes in the app.  It's more work, but it is work to solve an particular problem, so it is acceptable.

 

Also, look to the SharePoint side...since you are using the 'UPN-Manager' and 'UPN-Datenpfleger' columns in your filter...make sure you have Indexes set for both of those columns.  This will help tremendously.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

10 REPLIES 10
RandyHayes
Super User
Super User

@Bamboulete 

What are some of your formulas you are using that are causing performance issues?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 
thanks for awnsering so fast! 
In Powerapps:

 

Patch(Userlist;ThisItem; 
{
Valid:true;
'Email-Validator': varTest;
'letzte Validierung am': Now();
ValidDate: (DateAdd(
    DateAdd(
        Date(Year(Now());
             (RoundUp(Month(Now())/3;0) * 3) - 2;
              1
        );
        6;
        Months
    );
    -1;
    Days
))      
}
)


In Powershell:

$element = add-pnplistitem -force -values {
          Name = $name;
          Username = $username;
          Email = $mail;
          .....
          .....
       --> Its like 15 properties or so. I have the skript not here yet...

}

 

RandyHayes
Super User
Super User

@Bamboulete 

So this is an individual one-record patch!

 

How is that causing performance issues?  Or is it?  I was under the impression that you were trying to bulk change a lot of records.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Bamboulete
Regular Visitor

@RandyHayes 
Nope, this is the function on the button what is on each element(Each element here is one element in a sharepoint online list):

Bamboulete_0-1665693754330.png

 

But when a user clicks for example on the first green button and than on the next, its loading and the app becomes very slow.... i have no idea why this happens...

Bamboulete
Regular Visitor

Is there also a way to update all SP online items at once (Or all selected for example)?

Bamboulete
Regular Visitor

 

 

 

RandyHayes
Super User
Super User

@Bamboulete 

One aspect of PowerApps that is often overlooked is the dependency on the datasource in other places.

The way PowerApps works is that it is always real-time updated.  Meaning that, just like Excel (which PowerApps is modeled after), when you update a value in a cell that another cell has a referring formula to (and perhaps that too then has additional formulas from other cells, and so on), ALL the formulas update their information.

Same in PowerApps!  

If you update the datasource, and you have other formulas that use the datasource (commonly like your Gallery Items), then that formula must re-evaluate and update.  

These type of things cause "unseen" slowness.  It appears that the patch function is to blame, but it is really other formulas that rely on the datasource.

 

The BEST way to pinpoint performance issues is to utilize the monitor tool.  There you can see how much time any individual function takes (like your Patch specifically), and then you can see how long any other relying formula takes to update.

 

As for the update of all items, yes, you can do this, but there are some limitations and depending on the number of records...it still can take a good chunk of time.

 

If in-app real-time data related to the changes is not needed, then PowerAutomate can be utilized to do the work.  It will still take some time, but it will be out of band and not seen from the app perspective. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
Bamboulete
Regular Visitor

@RandyHayes 
Many thanks for the answer!
I have thought much wrong until your answer.
I think i got it!
Of course, i think its because of the large amount fo users and the computing load what happens all the time, when the filter for the user needs to "recalibrate" through the sync.
My Item Filter on the Gallery:

 

Filter(
    Userlist;
    ('UPN-Manager'=User().Email)||('UPN-Datenpfleger'=User().Email)
)

 

Bamboulete_0-1665694915431.png

 


Maybe 3.500 Sharepoint elements is to much to filter after each update...How can i handle this!?

So much thanks for your answer! 

Bamboulete
Regular Visitor

Another maybe important thing is, that i use the the email field to display an image of office365 in each item if available:

Bamboulete_1-1665695320797.png

 

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 (5,668)