SharePoint 2013 - SPLessons

Chapter 18

SharePoint Libraries

SharePoint Libraries

A Library is a list where each item in the list refers to a file that is stored in SharePoint. Libraries have all the same behaviors as lists, but because libraries contain files, they have extra features. One of these is the ability to be opened and modified through a compatible WebDAV client (e.g. Windows Explorer).

Many SharePoint document libraries are set up to require that documents be checked out before they can be edited (This option can be selected under Versioning Settings). After checking out a document, changes to the document are reflected in the library documents, not those on your computer, which allows everyone with library permission to access the updated file using a Web browser. A copy of the original document will be maintained in the document library.

Create custom Document library using CSOM in SharePoint

Go to the sharepoint site then go to the site content and click  on Add an app

click on Document library

Enter the name and create

We can find the  our created document library

Create custom Document library using Visual studio in SharePoint

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.Client;

namespace WebApplication4
{
    public partial class ListCreation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        { 
string url = "http://splesons:5151/";
ClientContext clientcontext = new ClientContext(url);
Web webSite = clientcontext.Web;

ListCreationInformation listCreateInfo = new ListCreationInformation();

listCreateInfo.Title = "Splessons";

listCreateInfo.TemplateType = (int)ListTemplateType.DocumentLibrary;

List oList = webSite.Lists.Add(listCreateInfo);
clientcontext.ExecuteQuery();
    
                            
            }

        }
    }