368d6fafea
Code backup
136 lines
4.9 KiB
C#
136 lines
4.9 KiB
C#
var ctx = _sam.GetContext(new Uri("https://italsortbuttrio.sharepoint.com/sites/DevelopTest"));
|
|
//var ctx = _sam.GetContext(_so.GetPurchasingSite());
|
|
|
|
var docLibraryName = "DocList";
|
|
var name = "Test02";
|
|
|
|
//var web = ctx.Web;
|
|
//ctx.Load(web, w => w.Url);
|
|
//var list = web.Lists.GetByTitle(docLibraryName);
|
|
//ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
|
|
//ctx.ExecuteQuery();
|
|
//list.ContentTypesEnabled = true;
|
|
//list.Update();
|
|
|
|
//if (!_cpt.ListContentTypeExist(ctx, docLibraryName, "Set di documenti"))
|
|
//{
|
|
// var documentCT = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
|
|
// ctx.Load(documentCT);
|
|
// ctx.ExecuteQuery();
|
|
|
|
// var ctDocSet = new ContentTypeCreationInformation()
|
|
// {
|
|
// Name = "Set di documenti",
|
|
// ParentContentType = documentCT
|
|
// };
|
|
// list.ContentTypes.Add(ctDocSet);
|
|
|
|
// list.Update();
|
|
// ctx.ExecuteQuery();
|
|
//}
|
|
|
|
//var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
|
|
//var contentType = ctData.FirstOrDefault();
|
|
//ctx.Load(contentType);
|
|
//ctx.ExecuteQuery();
|
|
|
|
//DocumentSet.Create(ctx, list.RootFolder, name, contentType.Id);
|
|
//ctx.ExecuteQuery();
|
|
|
|
|
|
var oList = ctx.Web.Lists.GetByTitle(docLibraryName);
|
|
|
|
CamlQuery cQuery = new CamlQuery()
|
|
{
|
|
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{name}</Value></Eq></Where></Query></View>"
|
|
};
|
|
|
|
|
|
var collection = oList.GetItems(cQuery);
|
|
|
|
ctx.Load(collection);
|
|
ctx.ExecuteQuery();
|
|
|
|
foreach (var oListItem in collection)
|
|
{
|
|
oListItem["MultiLink"] = "<a href=\"https://www.google.com\">Link1</a>" + "<a href=\"https://www.google.com\">Link2</a>" + "<a href=\"https://www.google.com\">Link3</a>";
|
|
oListItem.Update();
|
|
}
|
|
|
|
ctx.ExecuteQuery();
|
|
|
|
//----------
|
|
|
|
//
|
|
//var j = new Dictionary<string, string[]>()
|
|
//{
|
|
// { "PAL_ML", new string[] { "Note", "MultiLine", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
|
// //{ "PAL_DDT", new string[] { "TaxonomyFieldType", "DDT", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
|
|
|
|
//};
|
|
|
|
//var site = ctx.Site;
|
|
//ctx.Load(site, w => w.RootWeb, w => w.RootWeb.Fields);
|
|
//ctx.ExecuteQuery();
|
|
//foreach (var f in j)
|
|
//{
|
|
// var fieldXml = $"<Field Name='{f.Key}' Type='{f.Value[0]}' Description='' DisplayName='{f.Value[1]}' StaticName='{f.Key}' Group='{f.Value[2]}' Hidden='{f.Value[3]}' Required='{f.Value[4]}' Sealed='{f.Value[5]}' ShowInDisplayForm='{f.Value[6]}' ShowInEditForm='{f.Value[7]}' ShowInNewForm='{f.Value[8]}'>{f.Value[9]}</Field>";
|
|
// site.RootWeb.Fields.AddFieldAsXml(fieldXml, false, AddFieldOptions.AddToDefaultContentType);
|
|
|
|
// ctx.Load(site.RootWeb.Fields);
|
|
//}
|
|
|
|
//ctx.ExecuteQuery();
|
|
//
|
|
|
|
//----------
|
|
|
|
//var list = ctx.Web.Lists.GetByTitle(docLibraryName);
|
|
//ctx.Load(list);
|
|
//var lFields = list.Fields;
|
|
//ctx.Load(lFields);
|
|
//ctx.ExecuteQuery();
|
|
|
|
//if (lFields == null)
|
|
//{
|
|
// foreach (var field in lFields)
|
|
// {
|
|
// if (field.InternalName.Contains("PAL_Rich"))
|
|
// {
|
|
// field.ClientSideComponentProperties.
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
//----------
|
|
|
|
//
|
|
//var fields = new[] { "PAL_Rich" };
|
|
|
|
//ctx.Load(ctx.Web);
|
|
//ctx.Load(ctx.Web.Fields);
|
|
//ctx.ExecuteQuery();
|
|
|
|
//var siteColumns = ctx.Web.Fields.Where(g => g.Group == "PAL Field");
|
|
|
|
//if (siteColumns != null)
|
|
//{
|
|
// foreach (var c in siteColumns)
|
|
// {
|
|
// if (c.InternalName.Contains("PAL_RDA"))
|
|
// {
|
|
// c.TypeAsString = "TaxonomyFieldType";
|
|
// ctx.ExecuteQuery();
|
|
// }
|
|
// if (c.InternalName.Contains("PAL_DDT"))
|
|
// {
|
|
// c.TypeAsString = "TaxonomyFieldType";
|
|
// ctx.ExecuteQuery();
|
|
// }
|
|
// }
|
|
//}
|
|
//
|
|
|
|
//---------
|
|
|
|
|