2

I have a list definition that I've created in XML, and multiple list instances based on that definition. On the base list definition I am hiding certain fields from the new item form in the list definition schema.xml, as such:

<Field
   ID="{3E39F835-6DE9-41B8-A305-906F86DB609C}"
   Name="ExecutiveDashboardDueDateDraftBook"
   StaticName="ExecutiveDashboardDueDateDraftBook"
   DisplayName="Due Date: Draft Book"
   Type="DateTime"
   Format="DateOnly"
   Group="Executive Dashboard Columns"
   ShowInNewForm="FALSE"
   ShowInEditForm="TRUE"
   ShowInDisplayForm="TRUE" />

Other fields I have showing in the new item form:

<Field
    ID="{1EB0EAE1-DD67-44F9-AF78-5B5EDD18788C}"
    Name="ExecutiveDashboardDueDateFinalBook"
    StaticName="ExecutiveDashboardDueDateFinalBook"
    DisplayName="Due Date: Final Book"
    Type="DateTime"
    Format="DateOnly"
    Group="Executive Dashboard Columns"
    ShowInNewForm="TRUE"
    ShowInEditForm="TRUE"
    ShowInDisplayForm="TRUE" />

Is there a way in XML, on a list instance created from this definition, that I can specify what fields are visible in a new item form? Or even control the visibility at all for the field overall, i.e. show / hide the field altogether? Or is my only option to dive into some C# in a feature activated event receiver to change this once the list instance has been provisioned to the site?

Here is an example list instance I have:

<ListInstance Title="Submissions"
            OnQuickLaunch="FALSE"
            TemplateType="106"
            FeatureId="0c6906da-a35f-46f5-80b5-6857b138be6d"
            Url="Lists/SubmissionsEvents"
            Description="Use this list for entering submission events.">
</ListInstance>
1

Bit confused are you using a custom list definition or Microsoft one, the reason I ask is that the list instance is referencing a template of 106, the Event List, which is an out of the box list def.

You will need to use a copy of the schema.xml that Microsoft or you have created for the Event list. Find the definition in the SharePointRoot/Template/Features directory Associate the schema.xml with the list instance by using the ListInstance's CustomSchema attribute.

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

Now you have a copy of the schema, you can modify that List Instance's field configuration by modifying the field elements as required.

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.