博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
转:Defining Custom Columns in SharePoint – Field Types and Options
阅读量:5167 次
发布时间:2019-06-13

本文共 4006 字,大约阅读时间需要 13 分钟。

Defining Custom Columns in SharePoint – Field Types and Options

A common task for SharePoint developers is defining Site Columns (or Fields) as part of a Feature. When defining a field, you need to assign the field a type. I have created this reference table below to help you map between the the “Create Site Column” SharePoint page to the attributes you would set when defining the field as part of a feature.

Defining Columns using the UI
Create Site Column Page
Defining Columns in an Elements file as part of a feature
1: 
2:        Name="ActiveProject"
3:        DisplayName="Is Project Active"
4:        Group="Litware"
5:        Type="Boolean"/>

 

Type (as shown on the Create Column page) Field Type Notes MSDN Links
Single line of text Type=”Text”  
Multiple lines of text Type=”Note” In the Create Column page, can pick the type of text to allow. To enable the different sub-types, you need to set a couple of other attributes on the field element.
Plain Text
RichText=”FALSE”  (default value)
Rich Text
RichText=”TRUE”
RichTextMode=”Compatible”  (default value)
Enhanced Text
RichText=”TRUE”
RichTextMode=”FullHtml”
In addition, you can also set the number of lines to display using the NumLine attribute.
Further Information on MSDN:
Choice (menu to choose from) Single Choice
Type=”Choice”
Multi-Choice
Type=”MultiChoice"
Pick the display format for the Choice and Multi-Choice types, respectively:
Drop-Down Menu or Combo Box
Format=”Dropdowns”
Radio Buttons or Check Boxes
Format=”RadioButtons”
Define the options a user can pick from using the Choices element. Below is a skeleton to explain this.
<Field Name=”MyOptions” Type=……>
  <CHOICES>
     <CHOICE>Option 1</CHOICE>
     <CHOICE>Option 2</CHOICE>
  </CHOICES>
</Field>
If you would like to give the user an option to add their own value, set the attribute FillInChoice=”TRUE”.
Number Type=”Integer” This field type also lets you define:
Minimum Value (0 for example)
Min=”0”
Maximum Value (100 for example)
Max=”100”
Decimal Places (Default is Automatic, example 2 decimal places)
Decimals=”2”
Show as Percentage (Default is False)
Percentage=”FALSE”
Currency Type=”Currency” This field type also lets you define:
Minimum Value (0 for example)
Min=”0”
Maximum Value (100 for example)
Max=”100”
Decimal Places (Default is Automatic, example 2 decimal places)
Decimals=”2”
Currency Format
This sets the display format of the currency.
LCID=”3081”
3081 sets the format English – Australian. For a complete list of Locales, see the MSDN link in the next column.
Date and Time Type=”DateTime” This field also lets you define:
Date and Time Format
Show the date only:
Format=”DateOnly”
Show the date and time:
Format=”DateTime”
Yes/No Type=”Boolean” When setting the default value, you need to use the binary values:
No/False = 0
Yes/True = 1
Person or Group Single User or Group
Type=”User”
Multiple Users or Groups
Type=”MultiUser”
This field also lets you define:
Allow multiple selections
Set the Type to MultUser and the attribute Mult=”TRUE”
Allow selection of
People Only
UserSelectionMode=”PeopleOnly”
People and Groups
UserSelectionMode=”PeopleAndGroups”
Choose from
If you want to limit the option list to a SharePoint Group, use the UserSelectionScope attribute. Set it to the ID of the SharePoint group (Integer value). For example, UserSelectionScope=”3”.
Show field
Set the name of the field from the User’s profile properties that you want to display. For example, show the user’s name property:
ShowField=”Name”
If you would also like to show presence (Office Communicator integration required):
Presence=”TRUE”
Hyperlink or Picture Type=”URL” You can display the URL as a Hyperlink or Picture. Use the Format attribute to pick which one:
Hyperlink
Format=”Hyperlink”
Picture
Format=”Image”

 

Hope this helps you when defining site columns/field.

And one last thing, please remember to also define a group to your organise your fields using the Group=”My Columns” attribute!

转载于:https://www.cnblogs.com/wenjielee/archive/2010/12/29/1920410.html

你可能感兴趣的文章
java如何获取其它用户登录的真是IP地址
查看>>
Jquery通过指定层次关系获取元素
查看>>
c# for 和 foreach 的区别
查看>>
docfx (一)
查看>>
HashMap底层实现原理/HashMap与HashTable区别/HashMap与HashSet区别
查看>>
深度学习之前馈神经网络(前向传播和误差反向传播)
查看>>
IEnumerable<T>和IQueryable<T>区别
查看>>
【luogu P3381 最小费用最大流】 模板
查看>>
(转)MFC界面风格
查看>>
迁移ORACLE数据库文件到ASM
查看>>
Centos7 tmux1.6 安装
查看>>
二叉树(三)
查看>>
linux加密文件系统 fsck 无法修复一例
查看>>
【linux配置】VMware安装Redhat6.5
查看>>
javascript各类型的关系
查看>>
socket—套接字
查看>>
xml配置文件详解
查看>>
vue中 keep-alive 组件的作用
查看>>
非参数估计——Parzen窗与k近邻估计
查看>>
Linux(CentOS7)安装Tomcat
查看>>