Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

AddFieldAsXml throws exception

$
0
0

I am trying to add a field to SharePoint using the FieldCollection.addFieldAsXml() function from the sp.js library. This function works well, and I added many fields to my SharePoint Online Site Collection using it.

When I try to add a field of type TaxonomyFieldType and use customization tags to link a note field to the taxonomy field, SharePoint throws an exception: "Exception has been thrown by the target of an invocation".

My XML:

<Field ID="{E9EA4C70-F7EA-4FFB-9C91-6C62527EF148}"
           Name="OVSItemTaxKeywords"
           DisplayName="OVS Item Keywords"
           Type="TaxonomyFieldTypeMulti"
           ShowField="Term1033"
           Required="FALSE"
           Group="Ovs Companyweb"
           Mult="TRUE"><Default/><Customization><ArrayOfProperty><Property><Name>TextField</Name><Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{E701DB3D-637D-4AE0-A488-CD7ECD1F06A0}</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">true</Value></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></ArrayOfProperty></Customization></Field>

This also doesn't seem to work:

<Field ID="{E9EA4C70-F7EA-4FFB-9C91-6C62527EF148}"
           Name="OVSItemTaxKeywords"
           DisplayName="OVS Item Keywords"
           Type="TaxonomyFieldTypeMulti"
           ShowField="Term1033"
           Required="FALSE"
           Group="Ovs Companyweb"
           Mult="TRUE"><Customization></Customization></Field>

However, this works:

<Field ID="{E9EA4C70-F7EA-4FFB-9C91-6C62527EF148}"
           Name="OVSItemTaxKeywords"
           DisplayName="OVS Item Keywords"
           Type="TaxonomyFieldTypeMulti"
           ShowField="Term1033"
           Required="FALSE"
           Group="Ovs Companyweb"
           Mult="TRUE"></Field>

So I figured using Customization tags in this sp.js function is not allowed. So I tried adding customization tags to other fields, like so:

<Field ID="{E9EA4C70-F7EA-4FFB-9C91-6C62527EF148}"
           Name="OVSItemTaxKeywords"
           DisplayName="OVS Item Keywords"
           Type="Currency"
           Required="FALSE"
           Group="Ovs Companyweb" ><Customization></Customization></Field>

And this DOES work! What is the problem here? Is it a bug in SharePoint Online?



Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>