2

I have a custom content type derived from a publishing page. I want it to also have the fields from the event content type, so I added the fields exactly the same as specified in the ctypeswss.xml file.

<FieldRef ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}" Name="EventDate" 
   DisplayName="$Resources:core,Start_Time;" Format="DateTime" Sealed="TRUE" Required="TRUE" 
   FromBaseType="TRUE" Filterable="FALSE" FilterableNoRecurrence="TRUE" />

However when using the content type, the field is named "StartDate" instead of "EventDate".

How can I get the internal name for this field to be "EventDate"?

1

As far as I know you can't.

You are adding a REFERENCE to a field, and the original field is called StartDate. You can't modify its internal name since that is immutable.

That said - are you sure you are adding the correct field ref? I didn't find a field called "EventDate" in the SPBuiltInFieldId enum.

Also: you said that the above declaration sample is taken from an actual ootb content type. Have you used a tool like SharePoint Manager to view what is the reported name for the field in the content type? I suspect you will see "StartDate" as the name.

  • I've looked at the content type definitions in the file: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\ctypes.xml The strange thing is, it has two field declared in there with the same ID, one is called EventDate (part of the event content type), one is called StartDate (part of the task content type). Both with id 64cd368d-2f95-4bfc-a1f9-8d4324ecb007. Why does it use the StartDate as internal name and not EventDate? – Brinky Jan 9 '14 at 13:27
1

I think you can’t change the internal name when you use an OOB column. It’s a site column and it’s already created with its internal name. You are just using it in your content type. You can change the display name but not the internal name.

If you must have different internal name you can always define your own column and set the internal name as you want. Then use your column in your content type.

  • I don;t want to actually change the internal name. The content type "event" has an actual field with the internal name "EventDate". However when I add the field reference to that field it gets the internal name "StartDate". The declarations are located in the file: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES\ctypes.xml – Brinky Jan 9 '14 at 13:29
  • If you go to Event content type in content types gallery in a site you'll see that is has the field StartDate with internal name StartDate, not EventDate, even though it has Name="EventDate" in its content type definition. The same is happening with your content type. Internal name for that field is StartDate and can't be changed. – Naim Murati Jan 9 '14 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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