Retrieve SharePoint List items from a picture library and display them in a sharepoint webpart created using visual studio
Retrieve SharePoint List items from a picture library and display them in a sharepoint webpart created using visual studio
March 16th, 2015 6:56pm
you can use SPPictureLibrary and Random number classes in C# webpart code-
SPWeb web = SPContext.Current.Web; SPPictureLibrary picLib = (SPPictureLibrary)web.Lists["Photos"]; int count = picLib.ItemCount; Random rNumber = new Random(); int index = rNumber.Next(count); string sourceurl = web.Url + "/" + picLib.Items[index].Url; var image = new Image(); image.ImageUrl = sourceurl; image.Height = 300; this.Controls.Add(image);
Please check this for how to create a webpart -
Walkthrough: Creating a Web Part for SharePoint
You can also use Picture Library Slide Show webpart - http://www.splessons.com/lesson/sharepoint-picture-library-slideshow-web-part/
Free Windows Admin Tool Kit Click here and download it now
March 17th, 2015 2:58am