Hi All,
In this blog we are going to see enable versioning for the list - You can specify whether Create a version each time you edit an item in the list by enabling /disabling versioning for the list 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.EnableVersioning = false; // Disable Enable Versioning for list
olist.EnableVersioning = true; // Enable Enable Versioning for list
// Update the list
olist.Update();
//Execute the query
clientContext.ExecuteQuery();
}
}
}
In this blog we are going to see enable versioning for the list - You can specify whether Create a version each time you edit an item in the list by enabling /disabling versioning for the list 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.EnableVersioning = false; // Disable Enable Versioning for list
olist.EnableVersioning = true; // Enable Enable Versioning for list
// Update the list
olist.Update();
//Execute the query
clientContext.ExecuteQuery();
}
}
}
Happy Coding.Thank you :-)
ConversionConversion EmoticonEmoticon