Client Objet Model (OM) is a great new addition in SharePoint 2010. I have discussed before how to manipulate lists and list items using Managed Object Model. Today I’ll discuss on how to attach file to list item or add file to library using Managed Client Object Model. Upload File in Library The following code snippet shows how to upload file in document library: public void UploadFileInLibrary( string siteUrl, string webName, string libraryName, string subfolderPath, string fileName) { using (ClientContext clientContext = new ClientContext(siteUrl)) { string uploadLocation = Path.GetFileName(fileName); if (! string .IsNullOrEmpty(subfolderPath)) { uploadLocation = string .Format( "{0}/{1}" , subfolderPath, uploadLocation); } uploadLocation = string .Format( "/{0}/{1}/{2}" , webName, libraryName, uploadLocation); var list = clientContext.Web.Lists.GetByTitle(libraryName); ...
Angular, Javascript, HTML 5, CSS, Enterprise solutions. Expertise in Office 365, SharePoint Online, SharePoint 2013, Azure, MVC, Angular JS, KnockOut, Kendo UI, .Net Core. Asp.Net MVC, Web API, Angular 6, Azure AD, Azure Web App, Sql Server 2008, Bootstrap 3, HTML5, CSS3.