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've been tasked with creating a fairly complex system in sharepoint 2010. Coming from a background of from-scratch .NET applications, I'm used to defining tables with their own "local" columns.

My approach to this sharepoint project however, is leaving me with the sense, I'm doing something wrong.

I fired up VS2010 and started making content types, for which I want to make list definitions, and then list instances, so my entire "database" of sharepoint lists will be created at the flick of a feature. (Please stop me, if I'm going about this the wrong way)

Now, in creating my content types, I'm defining my < fields> right above my < ContentType> like so:

<Field ID="{GUID]" Name="UserLookup" DisplayName="User" Type="Lookup" FieldRef="ID" ShowField="ID"></Field>
<ContentType ID="0x01004df1f9fc39ee49569a3dfc2967f81f64"
...>
<FieldRefs>
  <FieldRef ID="{GUID}" Name="UserLookup" DisplayName="User"/>
</FieldRefs>

I have no problem getting this to work. However, when I create my other content types and lists, they're going to need some of the same fields, but not necessarily be the exact same field - it might just be the name and type that's similar. But since these fields are created as a site column, no two can have the same name. It's like they're "global".

Is there no way to create a content type with fields defined JUST for that content type? Allowing other content types fields with the same name, but different definitions?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

You can override some of the properties content type per content type (DisplayName, Required, etc.). This will allow you to reuse existing types.

If replacing properties is not enough, you can create different fields, with different staticname, name and ID, but with same display name (could lead to confusion to user though).

A last word, while it's not possible to create fields from a specific content type, you can create fields specific to list.

share|improve this answer
    
Yes, I just thought of that. Completely abandoning the idea of content types, and simple making List Definitions, as I have no reason for the columns/content types to be re-usable elsewhere. Would this work? –  Dynde Jun 22 '12 at 9:59
1  
this should work. Just remember to look forward. Will you one day require to have several lists with the same content type? If yes, create content type today. The typical example I can quote is when you have to create a new list "Archived" where you put items after their business lifecycle. –  Steve B Jun 22 '12 at 10:09
    
Considering this particular sharepoint application is supposed to be unique, solitary, and only care about itself, I can't think of a reason for content types. I think it creates more problems than solutions in my case. Thank you though! –  Dynde Jun 22 '12 at 10:16
    
Now if only I could remove that damn title field! :) –  Dynde Jun 22 '12 at 10:27
1  
You can :) take a look at a question from me –  Steve B Jun 22 '12 at 10:47
show 2 more comments

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.