我需要在不访问列表的情况下获取Sharepoint 2007中Sharepoint字段选择列的值
我想这样做,但不需要访问列表“项目”,也就是说,可以使用根站点或contenttype访问列,而不依赖于可以在Sharepoint应用程序中创建或不在Sharepoint应用程序中创建的列表我需要在不访问列表的情况下获取Sharepoint 2007中Sharepoint字段选择列的值,sharepoint,sharepoint-2007,moss,Sharepoint,Sharepoint 2007,Moss,我想这样做,但不需要访问列表“项目”,也就是说,可以使用根站点或contenttype访问列,而不依赖于可以在Sharepoint应用程序中创建或不在Sharepoint应用程序中创建的列表 SPFieldChoice choice = (SPFieldChoice)items.Fields[namefield]; foreach (string choiceName in choice.Choices) {
SPFieldChoice choice = (SPFieldChoice)items.Fields[namefield];
foreach (string choiceName in choice.Choices)
{
//etc...
}
您可以使用
web.Fields
或ContentTypes[typeName]。Fields
:
SPWeb web = ... ;
SPFieldChoice choice = (SPFieldChoice)web.Fields[namefield];
或
SPFieldChoice choice = (SPFieldChoice)web.ContentTypes[typeName].Fields[namefield];