Sharepoint 2010 SPListTemplate, how to get a list of fields?

Do I need to get all fields from my list template? How can i do this?

var web = site.OpenWeb();
var template = web.ListTemplates["SomeTemplate"];
template ... ???? -There is no method to get fields.
+3
source share
1 answer

There is no built-in method for retrieving all fields from a list template. The only way to get the fields is to separate the "XML schemas" in the list and get all the <Field>and tags <FieldRef>.

It is easier to create an instance of the list, which you can request later with the following examples.

To get all fields from a list, you can use a property SPList.Fields, for example. So:

foreach (SPField spField in myList.Fields)
{
    //your code here
}

MSDN SPListItem.Fields

" " SPListItem.Fields . SO-: , SharePoint Client?

+2

Source: https://habr.com/ru/post/1794114/


All Articles