How can I access a Sharepoint picture library in my custom web part?
-
16-10-2019 - |
Pergunta
I am looking to create a web part that simply selects a random image from a picture library and displays it. What is the accepted method for accessing images in a picture library?
Solução 2
I've found the solution through the Microsoft.Sharepoint.SPPictureLibrary
class. It is a layer on top of the SPList
class, letting you access the pictures in a picture library by manipulating the SPListItems
in the library.
Outras dicas
There is an example on codeplex: SharePoint Ad Rotator
Introduction: SPAdRotator is a SharePoint Web Part that can randomly display images from a SharePoint library. Images can be displayed either one at a time (a new random image is selected every time the page is loaded), or all images can be displayed while the user is viewing the page (with a configurable transition effect).