Skip to content

[BUG] Internal database Corruption Caused by AddFieldFromXml with Full XML Definition of Taxonomy Field #4797

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 6 tasks
Myjestic opened this issue Mar 15, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Myjestic
Copy link

Myjestic commented Mar 15, 2025

Issue:

Using AddFieldFromXml with a fully populated XML definition for a Taxonomy field can corrupt the internal database that manages the site's columns and content types.
This issue is difficult to fix, and in most cases, it will require Microsoft Support assistance.

WARNING! Do not apply the attached XML definition to a production site using AddFieldFromXml. Only use a test site for this.

Applying the attached XML with AddFieldFromXml will result in a corrupted internal database. You will no longer be able to fetch fields from the site using PnP-GetFields, and content types will become inaccessible through the UI.

Exception has been thrown by the target of an invocation

Every method of accessing fields (CSOM, API, PnP Functions) will throw this error.

I attempted to create a new content type on the site, which resulted in the error: "Something went wrong, please try again later." I managed to create a new field with the same internal name as the one causing the issue. The field's type or other settings do not matter; only the internal name is significant.
After creating the new field, you will be able to retrieve all fields again using PnP-GetFields. However, you will see at least two columns with the same internal name and the same GUID.

The problematic section in the XML is located between <Customization></Customization>. Removing the <Customization> section allows the creation to proceed successfully.

Actual Behavior:

Exception has been thrown by the target of an invocation

Image

No access to fields and content types afterwards

Steps to Reproduce Behavior:

Refer to the description above.

What is the version of the Cmdlet module you are running?

  • 2.12.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other: Please specify

Faulty XML:
<?xml version="1.0" encoding="utf-8"?> <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Field ID="{cb20sdf8-5a9c-4824-99b3-bf18fsdfefb9}" Name="CorruptingTaxonomyField" StaticName="CorruptingTaxonomyField" DisplayName="CorruptingTaxonomyField" Type="TaxonomyFieldType" Group="TEST" Filterable="TRUE" List="{e53b2349-faf3-4234-bd41-e234c6781405}" WebId="1c5b2d40-1d5e-47ba-a772-db95f4a84c0e" ShowField="Term1033" CustomFormatter="" EnforceUniqueValues="FALSE" Required="FALSE" > <Customization> <ArrayOfProperty> <Property> <Name>SspId</Name> <Value xmlns:q1="http://www.w3.org/2001/XMLSchema" p4:type="q1:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"> 036c1ffa-2869-427d-a718-c683sdfbcd24</Value> </Property> <Property> <Name>GroupId</Name> </Property> <Property> <Name>TermSetId</Name> <Value xmlns:q2="http://www.w3.org/2001/XMLSchema" p4:type="q2:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"> 6ce2c569-c6aa-4cfa-8df3-079c14c2a4ab</Value> </Property> <Property> <Name>AnchorId</Name> <Value xmlns:q3="http://www.w3.org/2001/XMLSchema" p4:type="q3:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"> 00000000-0000-0000-0000-000000000000</Value> </Property> <Property> <Name>UserCreated</Name> <Value xmlns:q4="http://www.w3.org/2001/XMLSchema" p4:type="q4:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>Open</Name> <Value xmlns:q5="http://www.w3.org/2001/XMLSchema" p4:type="q5:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>IsPathRendered</Name> <Value xmlns:q7="http://www.w3.org/2001/XMLSchema" p4:type="q7:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>IsKeyword</Name> <Value xmlns:q8="http://www.w3.org/2001/XMLSchema" p4:type="q8:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>TargetTemplate</Name> </Property> <Property> <Name>CreateValuesInEditForm</Name> <Value xmlns:q9="http://www.w3.org/2001/XMLSchema" p4:type="q9:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>IsDocTagsEnabled</Name> <Value xmlns:q10="http://www.w3.org/2001/XMLSchema" p4:type="q10:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>IsEnhancedImageTaggingEnabled</Name> <Value xmlns:q11="http://www.w3.org/2001/XMLSchema" p4:type="q11:boolean" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">false</Value> </Property> <Property> <Name>FilterAssemblyStrongName</Name> <Value xmlns:q12="http://www.w3.org/2001/XMLSchema" p4:type="q12:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">Microsoft.SharePoint.Taxonomy, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Value> </Property> <Property> <Name>FilterClassName</Name> <Value xmlns:q13="http://www.w3.org/2001/XMLSchema" p4:type="q13:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance"> Microsoft.SharePoint.Taxonomy.TaxonomyField</Value> </Property> <Property> <Name>FilterMethodName</Name> <Value xmlns:q14="http://www.w3.org/2001/XMLSchema" p4:type="q14:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">GetFilteringHtml</Value> </Property> <Property> <Name>FilterJavascriptProperty</Name> <Value xmlns:q15="http://www.w3.org/2001/XMLSchema" p4:type="q15:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">FilteringJavascript</Value> </Property> </ArrayOfProperty> </Customization> </Field> </Elements>

@Myjestic Myjestic added the bug Something isn't working label Mar 15, 2025
@Myjestic
Copy link
Author

Wow, I did some further investigation on this and found out that this issue has been known for a long time and is still not fixed:
🔗 GitHub Issue 1638
🔗 GitHub Issue 1951
🔗 GitHub Issue 1366

It’s been almost 10 years since the first ticket was created, yet the root cause is still unknown!
And just to mention—this isn’t only an issue when provisioning from one tenant to another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant