/// <summary>
/// Add ContentType in Library
/// </summary>
/// <param name="list"></param>
/// <param name="contentType"></param>
/// <returns></returns>
public static bool AddContentTypeLibrary(this SPList list, string contentType)
{
try
{
var listSharePoint = new ListSharePoint(list.ParentWeb,Logger, list.Title);
if (listSharePoint.ExistContentType("Item")) listSharePoint.DeleteContentType("Item");
if (listSharePoint.ExistContentType("Document")) listSharePoint.DeleteContentType("Document");
if (listSharePoint.ExistContentType("Element")) listSharePoint.DeleteContentType("Element");
return !listSharePoint.ExistContentType(contentType) && listSharePoint.AddContentType(contentType);
}
catch (Exception exception)
{
Logger.Error(string.Concat("Error AddContentTypeLibrary", exception.Message));
return false;
}
}