Cannot complete this action – error when adding a ContentType to a list
Today I got a nice error from my SharePoint development box after I tried to add a certain Content Type to a list.
Cannot complete this action. Please try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd) at Microsoft.SharePoint.Library.SPRequest.AddField(String bstrUrl, String bstrListName, String bstrSchemaXml, Int32 grfAdd)
Tell me
This is an error message every developer fells in love with. Its full of nothing…
Further analysis revealed that there must be a problem with a custom field definition inside that Content Type. Even more investigation found the culprit.
<Field Type="LookupMulti" DisplayName="CustomField" Required="FALSE" Description="My custom field" Group="Custom" StaticName="MyCustomField" Name="MyCustomField" ShowField="Title" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" ShowInViewForms="TRUE" Mult="TRUE" Sortable="FALSE" Indexed="TRUE" UnlimitedLengthInDocumentLibrary="TRUE" List="myList" SourceID="{31DCE571-D649-41b8-99D7-448F43FCEAC0}" />
Conclusion
NEVER set the attribute Indexed to TRUE when the field is a Lookup-Field that has the Mult-attribute set to TRUE!
<Field Type="LookupMulti" DisplayName="CustomField" Required="FALSE" Description="My custom field" Group="Custom" StaticName="MyCustomField" Name="MyCustomField" ShowField="Title" ShowInDisplayForm="TRUE" ShowInEditForm="TRUE" ShowInNewForm="TRUE" ShowInViewForms="TRUE" Mult="TRUE" Sortable="FALSE" Indexed="FALSE" UnlimitedLengthInDocumentLibrary="TRUE" List="myList" SourceID="{31DCE571-D649-41b8-99D7-448F43FCEAC0}" />
- July 20th
Leave a Reply