/// <summary>
/// 得到图片新闻的类型
/// </summary>
/// <returns></returns>
public List<string> GetAllTypes()
{
List<string> listAll = new List<string>();
SPSite site = null;
SPWeb web = null;
Guid guid = SPContext.Current.Site.ID;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate()
{
site = new SPSite(guid);
web = site.OpenWeb();
SPList list = web.Lists[ListNameConfiguration.PictureNews];
SPListItemCollection listItems = list.Items;
SPFieldChoice spf = (SPFieldChoice)list.Fields["类别"];
foreach (string sf in spf.Choices)
{
listAll.Add(sf);
}
});
return listAll;
}
catch (Exception ex)
{
return null;
}
finally
{
if (web != null) { web.Dispose(); }
if (site != null) { site.Dispose(); }
}
}