Пример #1
0
        private void CreateField(GtField field, FieldCollection fields)
        {
            var   fieldXml = field.GetFieldAsXml();
            Field newField = fields.AddFieldAsXml(fieldXml, true, AddFieldOptions.AddFieldInternalNameHint);

            ClientContext.Load(newField);
            ClientContext.ExecuteQuery();
        }
Пример #2
0
        private void CreateTaxonomyField(GtField field, FieldCollection fields)
        {
            var fieldSchema = field.GetFieldAsXml();
            var newField    = fields.AddFieldAsXml(fieldSchema, false, AddFieldOptions.AddFieldInternalNameHint);

            ClientContext.Load(newField);
            ClientContext.ExecuteQuery();

            var termSetId        = GetTermSetId(field);
            var newTaxonomyField = ClientContext.CastTo <TaxonomyField>(newField);

            newTaxonomyField.SspId          = field.SspId;
            newTaxonomyField.TermSetId      = termSetId;
            newTaxonomyField.TargetTemplate = String.Empty;
            newTaxonomyField.AnchorId       = Guid.Empty;
            newTaxonomyField.Update();
            ClientContext.ExecuteQuery();
        }