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

  • Home
  • SEARCH
  • 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 8614353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:06:08+00:00 2026-06-12T05:06:08+00:00

I’m using Sharepoint 2010’s web services interface to try to get the columns for

  • 0

I’m using Sharepoint 2010’s web services interface to try to get the columns for a given list. I’ve got not problem with getting all of the columns using a GetList() call, but the issue is that I need to only get the columns that the user can see in the List Settings view of the Sharepoint UI.

The code that I’m currently using is as follows:

rootNode = serviceReference.GetList(List_id.ToString());
Element element = XElement.Parse(rootNode.OuterXml);
var fields = from e in element.Descendants()
             where e.Name.LocalName == "Field" && e.Attribute("ID") != null &&
             !(e.Attribute("Name").Value.StartsWith("_") && e.Attribute("SourceID").Value == "http://schemas.microsoft.com/sharepoint/v3")            
             select e;

Where serviceReference is an instance of the Sharepoint Lists Service and List_id is the GUID representing the list internally to Sharepoint.

This does filter out some of the columns that I don’t want, but it doesn’t get rid of everything.

Does anybody know what attributes I’m looking for to narrow it down just to the ones that the user can select to be added to a view? Or am I going about this entirely the wrong way?

Many thanks for any help.

  • 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-06-12T05:06:09+00:00Added an answer on June 12, 2026 at 5:06 am

    The answer to this was that I was indeed looking in the wrong place for the information I needed. As user823959 pointed out, I needed to get the content type definition and use the fields in there rather than the list itself.

    To do this was a two stage process, firstly we need to get the list of content types using the Lists.GetListContentTypes method (although this takes a content type id parameter, it doesn’t actually seem to matter what we put here)

        XmlNode rootNode = serviceReference.GetListContentTypes(List_id.ToString(), "0×01");
    

    The CAML returned contains the definitions for each of the content types that are available in the list – with the first content type returned being the default one (in my case, the one I was after)

        String contentType = rootNode.ChildNodes[0].Attributes["ID"].Value;
    

    Once we’ve got the content type that we’re after we can make a call to GetListContentType with the appropriate list content type id to get the full definition of the content type:

        XmlNode contentTypeNode = serviceReference.GetListContentType(List_id.ToString(), contentType);
    

    The CAML returned from this call will contain a list of field elements that correctly show the fields that are available in the SharePoint UI’s view configuration. They can be selected in a LINQ query like this:

        XElement contentTypesElement = XElement.Parse(contentTypeNode.OuterXml);
    
        var fields = from e in contentTypesElement.Descendants()
                     where e.Name.LocalName == "Field"
                     select e;
    

    At this point, we’ve got a list of Field XML elements that contain information about display names, static names, content types and a whole lot more. See Microsoft’s documentation on the Lists.GetListContentType page for more information on the range of information returned about each field.

    Many Thanks to user823959 for pointing me in the right direction.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains

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.