Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question
    
Did you define the column group "My Group" elsewhere in your list definition? That looks like the only thing in there which could be throwing an error on an existing list or list type, as "My Group" is not one of the default column groups. –  NotVonKaiser Jun 4 '13 at 22:19
    
I did not define any column group. I always thought that adding a "Group" attribute to a site column would be sufficient?! –  Stephan Jun 5 '13 at 9:14
add comment

2 Answers 2

Site columns in content types is a great way to group several columns in a meaningful (and reusable) way, and then attach the content types to the list. Having said that, you can define all the site columns in one file (Say SiteColumns.xml) and user FieldRef to reference them in your content types (say ContentTypes.xml). You can always ensure to activate Content Types/Site-columns feature first, before using them in your custom lists.

I really don't think so if the Overwrite attribute has to play any role, except updating the field definition. The underlying error is possibly occurring because some of your column may not be provisioning correctly.

share|improve this answer
    
That's exactly what I'm doing: I define the site column in one XML file and I use it in a content type, that is defined in another XML file. (And I use it in deployed list as well (Schema.xml), which works fine). But I cannot add the column to other lists even though the feature is activated –  Stephan Jun 5 '13 at 9:02
    
Can you add the columns via SharePoint interface? –  Falak Mahmood Jun 5 '13 at 10:53
    
No, I get an error page with the mentioned ArgumentException. –  Stephan Jun 5 '13 at 14:08
    
Why your field column is not using SourceID attribute? SourceId is supposed to be set by the framework to the feature that created the field. SourceId is supposed to help you work back to the feature that created the fields SourceID="http://schemas.microsoft.com/sharepoint/v3/fields"/>. Check this link for more details: sharepointchick.com/archive/2009/06/30/… –  Falak Mahmood Jun 5 '13 at 14:42
    
If the SourceID is supposed to be set by the framework, why should I add it to my field definition? –  Stephan Jun 10 '13 at 12:45
add comment

If the field "My Products" exist in the site with the same ID so you should add just a reference to this field. I mean you should use <FieldRef >. Otherwise try to change the ID and the Name of your new field.

share|improve this answer
    
The field does not exist and there is no field with the same ID. –  Stephan Jun 3 '13 at 9:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.