I'am deploying some site columns, content types and lists to my site via CAML definition. This works as expected. However, I faced problems with re-using site columns that reference my lists.
My site column definition looks like this:
<Field Name="MyProduct" DisplayName="My Product"
ID="{c7118bfc-7848-499a-9f7c-5700576be23f}" Type="Lookup" Group="My Group"
List="Lists/MyProducts" ShowField="Title" />
This field is contained in a CAML content type definition and in a CAML list definition(schema.xml). I have no problems with this list, everything works as expected. But whenever I try to add the field to another list (in SharePoint via Browser as well as programmatically in a command line tool) I get an ArgumentException
with the corresponding nativehr but without further details, not even in the log files.
For some other problems it is often suggested to add the Overwrite="TRUE"
attribute to the field definition (e.g. here, here,...). This solves my problem, too.
But the documentation of the attribute on MSDN does not give me an explanation why this solution works:
Specifies whether the field definition for a new field that is activated on a site (SPWeb) overwrites the field definition for an existing field, in cases where the new field has the same field ID as the existing field. True if the new field overwrites the existing field with the same field ID; otherwise false. The default is false.
The problem also occurrs when I don't use the lookups in my custom lists. And I also tried it with complete removal of all my lists, content types and site columns - same result.
Could someone please explain me what makes the difference here between setting the Overwrite
attribute or not? Does it have any side effects to set the attribute value to TRUE
?