Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:08:59+00:00 2026-05-27T09:08:59+00:00

Hello and thanks for looking! Background I currently have a C# method for looping

  • 0

Hello and thanks for looking!

Background

I currently have a C# method for looping through a SharePoint List Collection and returning a lists of those SP Lists, including a nested list of their columns/SPFields.

Problem

How do I get a list of ONLY user-created fields in a SharePoint 2007 List via C#?

Code so far. . .

SPSite site = SPContext.Current.Site;
        SPWeb web = site.OpenWeb();
        web.AllowUnsafeUpdates = true;
        SPListCollection lists = web.Lists;

        var PellaListCollection = new List<PellaListModel>();
        
        foreach (SPList l in lists) {
                var PellaList = new PellaListModel();
                var PellaListColumns = new List<PellaListColumn>();
                foreach (SPField c in l.Fields) {
                    if (c.Hidden.Equals(false))
                    {
                        var type = c.FieldTypeDefinition.TypeName.ToString();
                        var col = new PellaListColumn
                        {
                            ColumnId = c.Id,
                            ColumnDataType = type,
                            ColumnTitle = c.Title
                        };
                        PellaListColumns.Add(col);
                    }
                }
                PellaList.ListColumns = PellaListColumns;
                PellaList.ListId = l.ID;
                PellaList.ListTitle = l.Title;
                PellaList.Description = l.Description;
                PellaListCollection.Add(PellaList);
        }
        
        web.AllowUnsafeUpdates = false;

        return PellaListCollection;
    }

As you can see, right now I am filtering by which SPFields are not "Hidden", but this still returns quite a few of the standard SharePoint generated fields with the list. I just need the fields the users have created.

Thanks!

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:09:00+00:00Added an answer on May 27, 2026 at 9:09 am

    You are looking for the FromBaseType property of SPField. This property is true if the field is part of the original schema for the List.

    Check out this good SharePoint Exchange article for more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello and thanks for looking! Background I am designing a greenfield application using .NET4
Hello and thanks for looking! Background I am building a commercial web application for
I have this kinda template text : Hello {#Name#}, Thanks for coming blah on
Introduction : Hello Everyone, I have been looking for days for a way to
Hello everyone thanks for looking into my problem. What I am trying to do
Hello and thanks for your opinion. I am creating a webservice. This webservice will
Hello and thanks to everyone for reading my question. I've been working on a
Hello (and thanks in advance) I'm in a bit of a quandry, I cant
Hello I have the following error by git-fsck, which cannot be cleaned by git-gc
I'm looking to write a short program (maybe a Hello World) in Java bytecode.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.