0

Struggling with this seemingly trivial issue of identifying a Documents Library from the of LISTS obtained via

https://<tenant>.sharepoint.com/_api/web/lists

endpoint (for Sharepoint Online)

API > https://msdn.microsoft.com/en-us/library/office/dn531433.aspx#bk_List

Could you please point to a field name that would serve the purpose?

I came across 2 fields

BaseTemplate

Gets the list definition type on which the list is based. Represents a ListTemplateType value. See ListTemplateType in the .NET client object model reference for template type values.

BaseType

Gets the base type for the list. Represents an SP.BaseType value: Generic List = 0; Document Library = 1; Discussion Board = 3; Survey = 4; Issue = 5.

I thought they would help me identify Document Library easily, but the issue is that the value which identifies a Document Library is also true for certain lists which I am not interested in.

Like SiteAssets etc.

How can I identify just the Document Library with actual files and folders?

Also, I tested out the ListItemEntityTypeFullName field, but I can't rely on it as it changed with diff locale settings like

"ListItemEntityTypeFullName": "SP.Data.Gedeelde_x0020__x0020_documentenItem"

How can I identify legit Document Libraries(with actual files and folders) on a particular site?

  • 1
    What makes you think Site Assets isn't a document library with files and folders? Last time I checked, it is. Use BaseType=1 then filter out what you don't want in the result processing. Site Assets, Site Collection Images, Style Library, etc are all legit document libraries, just not the ones you seem to want. Fortunately they are easily discernible by title in your result processing. There is no other type of document library like lists, they are one in the same. – Eric Alexander Jun 29 '17 at 18:06
  • Yes, correct. This seems to be the answer, sharepoint.stackexchange.com/questions/149277/… but the question here is the change in locale settings. I believe the EntityTypeName doesn't change with diff locales, but I have seen them changing for Document Libraries, don't want that for these System libs. For example, I am assuming that master page gallery's EntityTypeName shall always be > OData__x005f_catalogs_x002f_masterpage if that's the case, then I can surely rely on just the BaseType. Just want this confirmation that's all. – Syed Mauze Rehan Jun 29 '17 at 18:10
  • Can't rely on list titles. "Galerie met basispagina's" is the Dutch JSON response for Master Page Gallery, and "Siteactiva" for SiteAssets. That's the worry. – Syed Mauze Rehan Jun 29 '17 at 18:13
1

This is using PNP Powershell, and it will still show libraries such as: Style Lib/Asset Lib because well, they are document libraries, but it will at least separate the doc libs from the lists on the site.

get-pnplist | Where-Object{$_.BaseTemplate -eq 101} | Measure-Object | select count

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.