How to Upload Video file with metadata using CSOM in Sharepoint online /Office 365?
Hello SharePointers,
In this blog, we will provide CSOM Code to upload Video File in to Asset Library. Below is the CSOM code for your reference
Web web = context.Web;
List videoList = web.Lists.GetByTitle(“Assets”);
context.Load(videoList.RootFolder);
context.ExecuteQuery();
var contentType = GetContentType(context, videoList, “Video”);
var contentTypeId = contentType.Id;
VideoSet.CreateVideo(context, videoList.RootFolder, videoTitle, contentTypeId);
context.ExecuteQuery();
Microsoft.SharePoint.Client.Folder file = context.Web.GetFolderByServerRelativeUrl(videoList.RootFolder.ServerRelativeUrl + “/” + videoTitle);
context.Load(Ofile.ListItemAllFields);
context.ExecuteQuery();
file.ListItemAllFields[“Title”] = videoTitle;
file.ListItemAllFields[“VideoSetEmbedCode”] =embeddedCode;
file.ListItemAllFields.Update();
context.ExecuteQuery();
Happy SharePointing Guys.!!