Export (0) Print
Expand All

Site Columns

The ExecutionModels.Sandboxed solution deploys five site columns for use by the SOW content type and the Estimation content type. Site columns are defined by Field elements within a feature manifest file. As with all feature manifests, the contents of the manifest file remain the same regardless of whether you target a sandboxed solution or a farm solution. For example, the following code shows the definition of the SOW Status site column. This is taken from the Elements.xml file for the SiteColumns project item.

<Field ID="{91EBB5B9-D8C5-43C5-98A2-BCB1400438B7}"
       Name="SOWStatus"
       DisplayName="SOW Status"
       StaticName="SOWStatus"
       DisplaceOnUpgrade="TRUE"
       Group="SiteColumns"
       Type="Choice"
       Format="Dropdown">
  <CHOICES>
    <CHOICE>Draft</CHOICE>
    <CHOICE>Submitted</CHOICE>
    <CHOICE>Approved</CHOICE>
  </CHOICES>
</Field>

The site columns include a column named Projects Lookup that retrieves data from the Projects list, as shown in the following code example. Because this column retrieves data from the Projects list, you must make sure that the Projects list is in place before you deploy the lookup column. This is achieved through the feature activation dependencies described in Solution Design.

<Field ID="{F52FAC8A-7028-4BE1-B5C7-2A316AB1B88E}"
       Name="ProjectsLookup"
       DisplayName="Projects Lookup"
       StaticName="ProjectsLookup"
       Group="SiteColumns"
       DisplaceOnUpgrade="TRUE"
       Type="Lookup"
       ShowField="Title"
       WebId=""
       List="Lists/Projects">
</Field>

The ability to create lookup fields declaratively is a new feature in SharePoint 2010. For more information about the Field element schema, see Field Definition Schema on MSDN.


Show:
© 2015 Microsoft