且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Sharepoint客户端对象模型:如何获取列表中的所有字段

更新时间:2023-11-25 21:04:28

确定.找到了解决方案.在这里使用按标题获取的列表,但可以使用任何方法:

OK. Found the solution. Answer Here using a list I'm getting by title, but will work with any method:

// Get your ClientContext for your site  in 'clientContext'

SP.List oList = clientContext.Web.Lists.GetByTitle("List Title Here"); 
SP.FieldCollection fieldColl = oList.Fields;
clientContext.Load(fieldColl);
clientContext.ExecuteQuery();

foreach (SP.Field fieldTemp in fieldColl)
{
    MessageBox.Show(fieldTemp.InternalName.ToString()); //I used MessageBox to show, but you can do whatever you like with it here.
}