Hello dear colleques,
please - I am just trying to prepare some SP - COM tools for cloning lists from siteSource to SiteDest (SiteDest is Office365 encironment) I'd like to create (or modify if exists) all list on siteDest according siteSource. So, please here are my problems :
1) fields creation doesn't work on siteDest newly created list
public static void CreateListFromOldList(Context conDestList, SP.List listTemplate) { SP.Web oWebsite = conDestList.Web; //create schema info SP.ListCreationInformation inf = new SP.ListCreationInformation(); inf.Title = listTemplate.Title; inf.TemplateType = (int)listTemplate.BaseTemplate; //new list on dest site SP.List newList = oWebsite.Lists.Add(inf); //fields foreach (SP.Field fieldSource in listTemplate.Fields) { SP.Field fnew = newList.Fields.AddFieldAsXml(fieldSource.SchemaXml, true, SP.AddFieldOptions.DefaultValue); //new SP.Field(condestList.clientContext,newList); } newList.Update(); }
New list is created OK, but only field Title are stored in list schema .... where the bug is ?
2) is there any possibility to keep List.Id on newly created list the same, as an originla Id ?
Thank you very much, Marian
Marian