1

I need to check if specific document library exists on sharepoint site and I don't know the title of the library, because it is being created dynamically. The only thing I know is RootFolder.Name property of the library, which is also the part of the url.

As libraries collection of the site is pretty big (~20k records) it takes about 90 sec to execute the following code:

public static ClientContext ctx2010 = SharepointHelper.GetInstance(2010);

static void Main(string[] args)
{
    var lists_ = ctx2010.LoadQuery(
        ctx2010.Web.Lists.Where(
            l => l.RootFolder.Name == "10016193"));

    ctx2010.ExecuteQuery();
}

As I understand, this query retrieves all libraries first, then applies the limitation of 'where' clause.

Is there any way to improve performance of the query?

2
  • What version of SharePoint are you using? 2010 or 2013 ? Sep 4, 2017 at 18:18
  • @GautamSheth, Sharepoint 2010, but CSOM API version 16.xxx Sep 5, 2017 at 6:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.