Aug 17 2021 04:03 AM - edited Aug 17 2021 05:48 AM
I have followed this tutorial and this documentation in order to create lists and columns within SharePoint Online. Everything seems to work fine when creating them for the first time. But when I try to modify an existing column within an existing list using elements-v2.xml, after redeploying the app in my app catalogue then updating the existing app, the modified columns haven't been updated.
The only thing that works successfully after updating my elements-v2.xml is creating new lists or adding columns to existing lists.
My elements.xml, schema.xml and package-solution.json are the same as in the tutorial in the first link.
Within elements-v2.xml I have:
(I want to add an additional choice on line 24)
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListInstance
FeatureId="00bfea71-de22-43b2-a848-c05709900100"
Title="New List"
Description="New list provisioned from v2"
TemplateType="100"
Url="Lists/NewList">
</ListInstance>
<Field ID="{943E7530-5E2B-4C02-8259-CCD93A9ECB18}"
Name="SPFxCostCenter"
DisplayName="Cost Center"
Type="Choice"
Required="FALSE"
Group="SPFx Columns">
<CHOICES>
<CHOICE>Administration</CHOICE>
<CHOICE>Information</CHOICE>
<CHOICE>Facilities</CHOICE>
<CHOICE>Operations</CHOICE>
<CHOICE>Sales</CHOICE>
<CHOICE>Marketing</CHOICE>
<CHOICE>New Choice</CHOICE>
</CHOICES>
</Field>
</Elements>
Within my upgrade-actions-v2.xml I have:
<ApplyElementManifests>
<ElementManifest Location="4d9c0146-1219-986c-8d4e-984b42efd732\elements-v2.xml" />
</ApplyElementManifests>
<AddContentTypeField
ContentTypeId="0x010042D0C1C200A14B6887742B6344675C8B"
FieldId="{943E7530-5E2B-4C02-8259-CCD93A9ECB18}"
PushDown="TRUE" />
Does anyone have any suggestions on how I can modify an existing column using spfx?
Sep 29 2021 01:51 PM
@Easty12345 did you manage to resolve this? I'm facing a similar issue...
Sep 29 2021 08:34 PM
Hi, @Easty12345, @dhendry
You would need to add the attribute Overwrite = "TRUE" (if you don't have any subsites) but if you have subsites, you would also need to add the attribute OverwriteInChildScopes = "TRUE".
It is by design for a choice field that by default the existing field will not be updated. This is because often end users or site owners/admin may make some changes to the choice values/options so you would need to be careful and make sure that noone is making any changes to the existing field that you don't want to overwrite when deploying the choice field.
Hope this helps.
Cheers
Felicia