Accessing list images

I am trying to display ListItems in a gridview.

I can access the elements of the list.

using (SPSite site = new SPSite("http://mysitehere......"))
{
    using (SPWeb web = site.OpenWeb())
    {
        SPList list = web.Lists["TestList"];
        .......
        .......
    }
}

      

How to access list images?

+1


a source to share


1 answer


The images in the list can be accessed with the following code:



 SPListItemCollection listItems = list.Items;

 foreach (SPListItem listItem in listItems)
 {
     SPListItem item = list.GetItemById(listItem.ID);
     string imageUrl = item.Url; //use imageUrl to do whatever ...
 }

      

+1


a source







All Articles