Advertisement
In this article I will explain how to create Programmatically enabling the contentmanagement,versioning,content approval for documents.
First I created a empty share point solution,In that we can able to see the Features,Right click AddFeature In Feature1EventReceiver write the below code,once we deploy I will enable automatically.
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
namespace DOCUMENT.Features.Feature1
{
/// <summary>
/// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
/// </summary>
/// <remarks>
/// The GUID attached to this class may be used during packaging and should not be modified.
/// </remarks>
[Guid("b51ec13e-683e-482f-8867-daa8afeecdd9")]
public class Feature1EventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
try
{
SPWeb web = properties.Feature.Parent as SPWeb;
SPList list = web.Lists["ListName"];
//enabling the content management
list.ContentTypesEnabled = true;
//enable both major and minor versioning
list.EnableVersioning = true;
list.EnableMinorVersions = true;
//Enabling content approval for the documents
list.EnableModeration = true;
//draft version visiblity of the documents.
list.DraftVersionVisibility = DraftVisibilityType.Approver;
list.Update();
}
catch (Exception e)
{
throw e;
}
}
}
}
First I created a empty share point solution,In that we can able to see the Features,Right click AddFeature In Feature1EventReceiver write the below code,once we deploy I will enable automatically.
using System;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Security;
namespace DOCUMENT.Features.Feature1
{
/// <summary>
/// This class handles events raised during feature activation, deactivation, installation, uninstallation, and upgrade.
/// </summary>
/// <remarks>
/// The GUID attached to this class may be used during packaging and should not be modified.
/// </remarks>
[Guid("b51ec13e-683e-482f-8867-daa8afeecdd9")]
public class Feature1EventReceiver : SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
try
{
SPWeb web = properties.Feature.Parent as SPWeb;
SPList list = web.Lists["ListName"];
//enabling the content management
list.ContentTypesEnabled = true;
//enable both major and minor versioning
list.EnableVersioning = true;
list.EnableMinorVersions = true;
//Enabling content approval for the documents
list.EnableModeration = true;
//draft version visiblity of the documents.
list.DraftVersionVisibility = DraftVisibilityType.Approver;
list.Update();
}
catch (Exception e)
{
throw e;
}
}
}
}
D0E59AEC36
ReplyDeletekiralık hacker
hacker arıyorum
kiralık hacker
hacker arıyorum
belek
BD82F791CD
ReplyDeletehacker bulma
kiralık hacker
tütün dünyası
-
-
8CF976197B
ReplyDeleteTakipçi Satın Al
M3u Listesi
Google Konum Ekleme
Stumble Guys Elmas Kodu
Avast EtkinleÅŸtirme Kodu
ReplyDeleteWhen exploring new methods for custom apparel, many enthusiasts are now turning to innovative solutions like Direct To Film Transfers. This technique offers vibrant colors and detailed designs, making it a popular choice for those seeking high-quality results. Whether you're a hobbyist or a professional, understanding the benefits of Direct To Film Transfers can help you achieve impressive outcomes with less hassle. Overall, it’s transforming the way personalized garments are created in the industry.