Hi All,
In this blog we are going to see list folder creation in list- You can specify whether "New Folder" Command available to make by enabling and disabling folder creation option in SharePoint list using CSOM.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using System.Security;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClientContext clientContext = new ClientContext(" <Your SharePoint Site URL>");
var passWord = new SecureString();
foreach (char c in "password".ToCharArray()) passWord.AppendChar(c);
// Authentication-with-sharepoint-online-and-the-client-side-object-model
clientContext.Credentials = new SharePointOnlineCredentials("Loginname@Yoursite.onmicrosoft.com", passWord);
// Get the SharePoint list by title
List olist = clientContext.Web.Lists.GetByTitle("Your Custom list");
olist.EnableFolderCreation = false; // Disable Folder Creation for list
olist.EnableFolderCreation = true; // Enable Folder Creation for list
// Update the list
olist.Update();
//Execute the query
clientContext.ExecuteQuery();
}
}
}
In this blog we are going to see list folder creation in list- You can specify whether "New Folder" Command available to make by enabling and disabling folder creation option in SharePoint list using CSOM.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint.Client;
using System.Security;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
ClientContext clientContext = new ClientContext(" <Your SharePoint Site URL>");
var passWord = new SecureString();
foreach (char c in "password".ToCharArray()) passWord.AppendChar(c);
// Authentication-with-sharepoint-online-and-the-client-side-object-model
clientContext.Credentials = new SharePointOnlineCredentials("Loginname@Yoursite.onmicrosoft.com", passWord);
// Get the SharePoint list by title
List olist = clientContext.Web.Lists.GetByTitle("Your Custom list");
olist.EnableFolderCreation = false; // Disable Folder Creation for list
olist.EnableFolderCreation = true; // Enable Folder Creation for list
// Update the list
olist.Update();
//Execute the query
clientContext.ExecuteQuery();
}
}
}
ConversionConversion EmoticonEmoticon