How to Get Library Name via Url Programmatically in SharePoint 2013 using client side (CSOM)

Just like site name, sometimes or most of the time, the url is different from the name of the library.
For example:
The url will be like “http://roel2013/sites/t1/lib1” but the library name is “library”
So we must not rely on the url for the library name.
To get the library name programatically, use the code below.

but this will only work if the url ends in a library url, what if the end of the url is folder or docset?
or a folder within a folder within a folder?
Have no fear, the ghostbusters are here.
Use the code below.

Leave a Reply

Your email address will not be published. Required fields are marked *