Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Disable folder creation for list in SharePoint using CSOM
WhatsApp
Gowtham Rajamanickam
9y
6.2
k
0
0
25
Blog
Steps
Open Visual Studio in your system
Select Console Applciation template and give as name "Enablefolder"
Add a Microsoft.Cleint Assembly refrence file in right side refrence tab in visual studio.
Replace Program.cs with the source code below.
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
Microsoft.SharePoint.Client;
namespace
CSOMCodeSamples
{
class
Program
{
static
void
Main(
string
[] args)
{
// ClientContext - Get the context for the SharePoint Site
ClientContext clientContext =
new
ClientContext(
"http://gauti.sharepoint.com/sites/sp"
);
// Get the SharePoint web
Web web = clientContext.Web;
// Get the SharePoint list by title
List list = web.Lists.GetByTitle(
"Newbook"
);
// Enable folder creation for the custom list
list.EnableFolderCreation =
false
;
// Update the list
list.Update();
// Execute the query to the server.
clientContext.ExecuteQuery();
}
}
}
Output
Hit F5 and see the magix happend in SharePoint 2013. Hope you have enjoyed this.!!! :-)
If you want to check the output goto Listsettings-->Select Advanced Settings-->Check the settings has been Disabled Successfully.
Disable folder creation for the list in the SharePoint 2013 using CSOM
Up Next
How To Get List Item From Particular Folder Of SharePoint List Using Rest API
Ebook Download
View all
Getting Started with SharePoint Framework Development using TypeScript, PnP JS, and React JS
Read by 4.9k people
Download Now!
Learn
View all
Membership not found