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?

Was it helpful?

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
scroll top