对象模型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>
很简单的东西,写出来做个记录。