-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too many SPO REST calls required to use LoadListDataAsStream( ) #1383
Comments
@wizofaus : interesting ask. The fact that there are 2 REST calls when the context is created is related to batching, initially we had one batch call to load all the initialization data, we however split that to one interactive call and one batch call as with the interactive call we do get the correct site URL casing, which is required for batching to work. Did you check this option: https://pnp.github.io/pnpcore/using-the-sdk/basics-context.html#loading-additional-iweb-and-isite-properties-when-creating-a-pnpcontext ? It will allow you to also load the web's lists as part of that second batch call. As possible future change we might enable the single batch call system again as something optional, the one using it however has to provide the URL is the exact casing...would this help you or are you dependent on URL's entered manually (with the risk of wrong casing being used)? |
Requiring exact casing is fine. At this stage this isn't the biggest issue, but it just struck me as an optimisation worth considering in the future
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Bert Jansen ***@***.***>
Sent: Monday, February 12, 2024 6:58:33 PM
To: pnp/pnpcore ***@***.***>
Cc: wizofaus ***@***.***>; Mention ***@***.***>
Subject: Re: [pnp/pnpcore] Too many SPO REST calls required to use LoadListDataAsStream( ) (Issue #1383)
@wizofaus<https://github.com/wizofaus> : interesting ask. The fact that there are 2 REST calls when the context is created is related to batching, initially we had one batch call to load all the initialization data, we however split that to one interactive call and one batch call as with the interactive call we do get the correct site URL casing, which is required for batching to work.
Did you check this option: https://pnp.github.io/pnpcore/using-the-sdk/basics-context.html#loading-additional-iweb-and-isite-properties-when-creating-a-pnpcontext ? It will allow you to also load the web's lists as part of that second batch call.
As possible future change we might enable the single batch call system again as something optional, the one using it however has to provide the URL is the exact casing...would this help you or are you dependent on URL's entered manually (with the risk of wrong casing being used)?
—
Reply to this email directly, view it on GitHub<#1383 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABI5UAMG2L7MZIOZ5BU7JRTYTHDSTAVCNFSM6AAAAABC3L7ATGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZYGE4TGOBVHA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
…undtrip to SharePoint if the valid site casing is used in combination with `PnPContextOptions.SiteUriCasingIsCorrect` #1383
@wizofaus : I've implemented support for this, using the using (var context = await pnpContextFactory.CreateAsync("SiteToWorkWith",
new PnPContextOptions()
{
SiteUriCasingIsCorrect = true
})
)
{
// Use the context
} See also https://pnp.github.io/pnpcore/using-the-sdk/basics-context.html. This feature will be part of the next nightly build. Closing this issue now. |
Category
Describe the bug
Currently due to the way PnPContextFactory.CreateAsync() works (always issuing at least 1 SPO REST call, 2 in my case), and the fact that I can't see how to get necessarily field data back from LoadListDataAsStreamAsync, I have to issue 4 separate SPO REST calls just to get the info I need from a library. With any sort of latency this can add up to a significant delay (500ms+).
Repro steps
Write minimal code for obtaining an IList from the PnP.Core library (e.g. PnPContextFactory.CreateAsync( ), context.Web.Lists.GetByIdAsync( )) then calling IList.LoadListDataAsStreamAsync() and monitor the number of HTTP calls issued and the time taken for them to execute fully.
Expected behavior
Ideally only a single SPO REST call is issued, two at most. Even caching previous results I can't really see how to reduce it from 4, and I'm not sure if it's sensible/safe to cache PnPContext / IList etc.
Environment details (development & target environment)
Additional context
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered: