Create a Folder in Document Library Using Client Object Model (CSOM)

Here, I demonstrated how to create a floder in a document library using CSOM


Example code for CSOM:




using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint;
namespace FolderCreation
{
    class Program
    {
        static void Main(string[] args)
        {
            ClientContext context = new ClientContext("http://win-pi0rfb9adj8/sites/Home/");
            Web oWeb = context.Web;
            List oList = oWeb.Lists.GetByTitle("Give your library");
            ListItemCreationInformation oCreationInfo = new ListItemCreationInformation();
            oCreationInfo.UnderlyingObjectType = FileSystemObjectType.Folder;
            oCreationInfo.LeafName = "Approved";
            ListItem oListItem = oList.AddItem(oCreationInfo);
            oListItem.Update();
            context.ExecuteQuery();
        }
    }
}

Comments

Popular posts from this blog

Download Visakhapatnam Tirupati AC Double Decker Express Act