Forum Discussion
Client Context Apply Retain Label to all list and libraries
Hi All,
I am using Console Application for the Web Job. I am creating some Sub sites and list/libraries with Client Context. I want to apply Retain Label to all list and library at the time of creation. I am using below code for List, Content Type and View creation for the list/Libraries.
Kindly let me know how I can apply Retain Label while creating list/libraris.
Sample Code:
List Creation:
ListCreationInformation olist = new ListCreationInformation();
olist.Description = LibraryName;
olist.Title = LibraryName;
olist.TemplateType = 101;
olistProDoc = ctx.Web.Lists.Add(olist);
ctx.Load(olistProDoc);
Content Type Creation:'
olistProDoc.ContentTypes.AddExistingContentType(CT_Advc_DocumentSet);
olistProDoc.ContentTypes.AddExistingContentType(CT_Advc_Document);
olistProDoc.ContentTypes.AddExistingContentType(CT_Advc_ProjectFolder);
ctx.ExecuteQuery();
Microsoft.SharePoint.Client.ContentTypeCollection olistProdeccurrentCtOrder = olistProDoc.ContentTypes;
ctx.Load(olistProdeccurrentCtOrder);
ctx.ExecuteQuery();
View Creation:
olistProDoc.CreateView("Default View", ViewType.None, viewFieldsolistProdec, 30, true, viewQuery, false, false);
olistProDoc.RootFolder.UniqueContentTypeOrder = reverceOrder;
olistProDoc.RootFolder.Update();
olistProDoc.ContentTypesEnabled = true;
olistProDoc.Update();
ctx.ExecuteQuery();