SharePoint 如何读取选项字段所有Choise
- 2021-12-02
- 来源/作者: 菜鸟图库/ 菜鸟图库
- 261 次浏览
对象模型SPFieldChoice
SPSite site = SPContext.Current.Site;
SPWeb web = site.OpenWeb(SubWebUrl);
SPList list = web.Lists[ListName];
SPFieldChoice fieldchoice = (SPFieldChoice)list.Fields["年份"];
for(int i=0;i<fieldchoice.Choices.Count;i++)
{
writer.write( fieldchoice.Choices[i].ToString());
}
XML描述
<Field Type="Choice" DisplayName="年份" Required="FALSE" Format="RadioButtons" FillInChoice="FALSE" ID="{485b2d85-f837-487b-9d2b-aba933b81ff8}" SourceID="{af88ae78-2c13-4f05-ada7-915fb355cdb0}" StaticName="Year" Name="Year" ColName="nvarchar5" RowOrdinal="0" IMEMode="" Version="1">
<Default>2010</Default>
<CHOICES><CHOICE>2010</CHOICE>
<CHOICE>2011</CHOICE>
<CHOICE>2012</CHOICE></CHOICES></Field>
很简单的东西,写出来做个记录。
标签(TAG) SharePoint读取选项字段所有Choise