Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

How retrieve custom fields only when using SPListItemCollection?

$
0
0

Hi with following code I am retrieving a DataTable from a List:

            using (SPSite site = new SPSite("http://..."))
            {
                using(SPWeb web = site.OpenWeb())
                {
                    SPList oList = web.Lists.TryGetList("Serverliste");

                    if(oList != null)
                    {
                        DataTable dt = oList.Items.GetDataTable();
                    }
                }
            }

This works fine. My problem is that I only want to get custom ListFields. When working with Fields one can simply callFromBaseType which will show if a Field is custom or not. The only value which seems right isIsCustomType. Though it is listed under Not public members, which makes it unaccessable via code for me, right?

Well a dirty approach would be to iterate through ListFields, match them with DataColumns and check whether they are custom or not.

Is there any clean, efficient solution for this? Is this possible using CamlQueries? If yes, how would that query look like?


Algorithmen und Datenstrukturen in C#: TechNet Wiki


Viewing all articles
Browse latest Browse all 11571

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>