[ ] Bug
[ X] Enhancement
[X ] Office 365 / SharePoint Online
[X ] SharePoint 2016
[X ] SharePoint 2013
A field can be added to a list but can not be added automatically to associated content types in the list.
this was fixed in the previous version and related to issue #1353
Due to the fix #1354
Versions before 09/2017 : fields in lists are automatically included in all content types
Versions after 09/2017 : fields in lists are not available in content types
the code for adding fields to lists :
field = listInfo.SiteList.Fields.AddFieldAsXml(fieldXml, false, AddFieldOptions.AddFieldInternalNameHint | AddFieldOptions.AddToNoContentType);
I think that the solution could be to expose AddFieldOptions in the schema. this will make us choose wether to include in the content types or not.
Hi @Zouche,
Shouldn't you add the field in the content type as fieldref then?
The PR #1354 allow a better mirroring the schema when exporting a site as a template and apply the template, which wasn't the case before the PR.
steve
Hi @stevebeauge,
it could be a good idea to use a content type that we reference in the list.
But the problem is when we reference a field from a list and get the template we will not have the fieldref, when we reapply the template, the field will not be referenced in the content type .
in order to give the choice to include fields in the content types or not, it's better to expose the AddFieldOptions, and change in the Extract and Provision methods and also the schema.
Zouche.
Any progress on this?
Hi,
Please see #1457 for further details. I'm going to close this item. Thanks for using the PnP Provisioning Engine.
Most helpful comment
Hi @stevebeauge,
it could be a good idea to use a content type that we reference in the list.
But the problem is when we reference a field from a list and get the template we will not have the fieldref, when we reapply the template, the field will not be referenced in the content type .
in order to give the choice to include fields in the content types or not, it's better to expose the AddFieldOptions, and change in the Extract and Provision methods and also the schema.
Zouche.