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 created a list in sharepoint by using visualstudio. The List is based on a custom contenttype. Because I want to delete the title field I've switched off inheritation of the Contenttype:

 <Elements xmlns="http://schemas.microsoft.com/sharepoint/">

  <Field ID="{51CC6776-F855-48d5-A4EC-B7CE11CE2324}"
      DisplayName="ExpiresDate" Name="ExpiresDate"
      Type="DateTime" Required="False"
      UnlimitedLengthInDocumentLibrary="FALSE"/>


  <!-- Parent ContentType: Element (0x01) -->
  <ContentType ID="0x0100b48c62c42879472aa8f1e1afc4dba7ce"
               Name="GroupsList - ContentTypeGroups"               
               Group="Custom Content Types"
               Description="My Content Type"
               Inherits="false"
               Version="0">
      <FieldRefs>
        <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" />

      <FieldRef ID="{51CC6776-F855-48d5-A4EC-B7CE11CE2324}" Name="ExpiresDate" Required="FALSE" ShowInNewForm="FALSE" ShowInEditForm="FALSE" />
      </FieldRefs>
  </ContentType>
</Elements>

Now I wanted to read out the fields content via powershell:

$site = New-Object Microsoft.SharePoint.SPSite($GroupListURL)
$web = $site.OpenWeb()
$list = $web.Lists[$GroupListName]
$items = $list.Items
$listitem = $list.Items.GetItemByID($ItemID)
$ExpiresDate = $listitem["ExpiresDate"]

But I'm only get Null for ExpiresDate. If I set inheritation to true I get ExpiresDates Value but the TitleField is still visible.

Does anyone know why?

share|improve this question
    
What do you get for $listitem.ContentTypeId? In other words, are you sure the list item is using your custom content type? –  Rich Bennema May 31 '12 at 17:52
add comment

migrated from stackoverflow.com Jun 2 '12 at 4:04

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 1 down vote accepted

You content type inherits from system/item according to the content type id:

0x0100b48c62c42879472aa8f1e1afc4dba7ce

See http://msdn.microsoft.com/en-us/library/aa543822.aspx

Title is a required to be a part of any content type that inherits from Item.

I'm not sure why you want to delete the Title field. If you want to inherit from the Item content type, can you just set a default value on the Title field and hide it?

share|improve this answer
    
Thanks! But how to hide the title field in visual studio? –  MOI May 31 '12 at 5:52
    
Include a FieldRef to it and set it's Hidden property to TRUE –  James Love Jun 2 '12 at 17:08
add comment

As Doug mention don't delete the Title field. The better way is to set it optional and then hide it. You will also have some drawback when you hide the title field. For example you will lose the dropdown menu because it is attached to the title field.

You can hide fields form a form by using powershell. I wrote about this in the following blog post. http://www.n8d.at/blog/sharepoint-2010/hide-fields-from-lists-and-content-types/

share|improve this answer
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.