DirectoryNotFoundException when trying to read Picture Library using Linq
-
10-12-2019 - |
Question
I am trying to read a picture library named "ImageLibrary" as follows:
SPList list = web.GetList("ImageLibrary");
But I am getting following error:
DirectoryNotFoundException
How do I read ImageLibrary?
Solution
SPWeb.GetList("") gets a-a list by its server relative path. See here API description.
So to get your list try to pass something like "/Lists/ImageLibrary". Or appropriate server relative path.
Hope it helps,
Andrew
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange