自定义字段的妙用

信息来源:

Joris [MVP Windows SharePoint Services]
就是那个在自己blog上放了超级多资源链接的那个大牛……
 
据称,SharePoint SDK上介绍如何订制列表模板的文章缺少了一步(我自己还没机会试,估计咱们这儿需要这么深度改列表模板的兄弟也不多,留这篇文章做参考吧)
 
但缺少的那步可以这样弥补。转引如下:
(注,他应该会在最近写一篇博详细说这个问题,大家可以关注一下)
 

The SharePoint SDK shows How to - Create a Custom List Definition but is strange enough not complete. If you follow the SDK sample - the extra field you created in your custom list definition will NOT show up in the SharePoint form pages (Edit item, new item and view item).

In the next posting, I will describe in short the different steps - the last step is the one which I think is missing.

· Create a new feature as explained in the SharePoint SDK. Afterwards install and activate the feature.

· Modify the SCHEMA.XML file - Add your custom field inthe Fields section

<Fields>
<Field Type="Choice" Name="FavoriteColor" DisplayName= "Favorite Color"

ID="{5F11FE7B-C8D4-4849-A400-133352D17ECF}">

 <CHOICES>

  <CHOICE>Red</CHOICE>

  <CHOICE>Green</CHOICE>

  <CHOICE>Blue</CHOICE>

 </CHOICES>

</Field>

</Fields>

· Add a reference to the Field you defined within the ViewFields section

<ViewFields>
 <FieldRef Name="Attachments" ></FieldRef >
 <FieldRef Name="LinkTitle" ></FieldRef>
 < FieldRef Name="FavoriteColor"></ FieldRef>
</ViewFields>

· Modify the ContentTypes section and modify the Item contenttype to include the custom column. This change will make sure that the custom column will also show up in the edit and new forms.

<ContentTypes>

 <ContentTypeRef ID="0x0120" />

 <ContentType ID="0x0100EE310F92BD4F4ee79829A2FB3A01F1ED"

 Name="Item" Group="List Content Types" Description

 ="Create a new list item." Version="2" FeatureId=

 "{695b6570-a48b-4a8e-8ea5-26ea7fc1d162}">

  <FieldRefs>

   <FieldRef ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}"

   Name="ContentType" />

   <FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}"

   Name="Title" Required="TRUE" ShowInNewForm=

   "TRUE" ShowInEditForm="TRUE" />

   <FieldRef ID="{5F11FE7B-C8D4-4849-A400-133352D17ECF}"

   Name="FavoriteColor"/>

  </FieldRefs>

  <XmlDocuments>

  <XmlDocument NamespaceURI="

       http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">

   <FormTemplates xmlns="

          http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">

    <Display>ListForm</Display>

    <Edit>ListForm</Edit>

    <New>ListForm</New>

   </FormTemplates>

  </XmlDocument>

 </XmlDocuments>

 <Folder TargetName="Item" />

</ContentType>

</ContentTypes>

· Finally create a new list using the new custom SharePoint list definition

  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jiangxng

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值