SharePoint Pals
 | Sign In
Video Gallery using SharePoint Asset Library and MVC APP
by Krishna KV 15 Aug 2016
Team Leader, Aspire Systems
Today  :   5     Total  :    1948

SharePoint asset library allows us to upload images, videos, audio and any kind of cataloging rich media asset with a thumbnail preview. It has the content type with Picture Size, Date Picture taken, Tagging, Duration in seconds. The video thumbnail can be generated by the video uploaded or any custom images. The asset library will not support the slide show of the picture.

To Add an asset library


Create a provided hosted app


 public class Video
 	public string Title { get; set; }
 	public string Url { get; set; }
 	public string Preview { get; set; }


         public ActionResult Index()
             List<Video> lstVideos = new List<Video>();
             User spUser = null;
             var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
             using (var client = spContext.CreateUserClientContextForSPHost())
                 if (client != null)
                     Uri uri=new Uri(spContext.SPHostUrl.AbsoluteUri);
                     var rootPath = uri.GetLeftPart(UriPartial.Authority);
                     var web = client.Web;
                     var list = web.Lists.GetByTitle("AstLibrary");
                     var listItem = list.GetItems(new CamlQuery());
                     client.Load(listItem, i => i.IncludeWithDefaultProperties(s => s.Folder.Files));
                     foreach (var item in listItem)
                         var preview = item.FieldValues["AlternateThumbnailUrl"];
                         lstVideos.Add(new Video()
                             Title = item["Title"].ToString(),
                             Preview = preview==null ?null: (preview as FieldUrlValue).Url,
            Url =string.Format("{0}{1}",rootPath,item.Folder.Files[0].ServerRelativeUrl)
             return View(lstVideos);


 @model List<ProvidedHosted.Video>
 <div class="row">
     @foreach (var lst in Model)
         <div class="col-sm-6">
             <video width="480" height="400" poster="@lst.Preview" controls="true">
                 <source src="@lst.Url" type="video/mp4" />

Upload a Video


Generating thumbnails from the uploaded video



Click the Save button to update the thumbnails

Run the project the output will displayed below


blog comments powered by Disqus

SharePoint Pals

SharePoint Pals, a community portal for SharePoint developers, Administrators and End Users. Let's join hands and share the point together.
Read this on mobile


Angular Js Training In Chennai
Advanced Angular Js training with real world developer scenarios
Angular Js, Web Api and Ionic for .Net Developers
All in one client side application development for .Net developers
Angular Js For SharePoint Developers
Get ready for the future. Its no more just C#

Get Connected

SharePoint Resources

SharePoint 2013 and 2010 Web Parts
Free Web Parts with Source Code for SharePoint Community

SharePoint 2013 Books and Tutorials
Collection of free SharePoint 2013 books and tutorials (eBooks, pdfs)

Supported By

Contribute your article and be eligible for a one month Free Subscription for Plural Sight. The Author of the most popular New Article (published in the previous month) will be awarded with a Free One month Plural Sight Subscription. Article can be sent to in a word document.

Related Resources

Recent Tweets

Twitter October 21, 21:34
How to Add a JS Link Reference to the Display Form or Any other ASPX Programmatically using CSOM PNP in SharePoint -

Twitter October 20, 13:01
How to Add a JS Link Reference to the NewForm and EditForm Programmatically using CSOM PNP in SharePoint Office 365-

Twitter October 12, 12:15
How to Deploy Provider Hosted Apps (Add-Ins) by App Stapling in SharePoint Office 365 -

Twitter October 11, 13:39
How to Deploy Provider HostedApp programmatically using CSOM in SharePoint Office 365 Activating Developer Feature -

Twitter October 10, 09:26
How to Use Angular HTTP Services in SharePoint List -

Follow us @SharePointPals
Note: For Customization and Configuration, CheckOutRecent Tweets Documentation