Using GetListContentType

May 18, 2011 at 1:58 PM

Hello all

I am trying to get the types of every field in a given list. So I am using the "GetListContentType" function of SPServices. Does anyone have an example of how to go through every field and determine its type (folder, text, number) etc..

I have been looking at the MSDN docs for hours and hours and can't seem to be able to find anything. Also is there a list of all of the possible types somewhere?

 

Thanks

May 18, 2011 at 2:50 PM

I'm thinking "GetList" is the operation you would want to use.  Check out the doc on MSDN and see if it's what you are looking for:

http://msdn.microsoft.com/en-us/library/lists.lists.getlist.aspx

May 18, 2011 at 3:07 PM
Edited May 18, 2011 at 3:07 PM

thanks for your reply. If GetList does this, then what is the purpose of GetListContentType?

The MSDN docs are rather vague on this matter and is confusing to a SharePoint newbie such as myself.

Coordinator
May 18, 2011 at 3:31 PM

Yes, the MSDN SDK is pretty confusing. However, it's beyond my pay grade to rewrite them! (Though I've tried my damndest to get someone at Microsoft to let me help improve them, with no success.)

If you look at the docs, though, GetListContentType "Returns the content type definition schema for the specified list content type.", in other words, it tells you abvout a particular Content Type available in the list. GetList "Returns a schema for the specified list.", which means it tells you about all of the columns and information available about the list.

If you are going to use the Web Services, unfortunately you'll need to become a good SDK spelunker.

M.

May 18, 2011 at 8:27 PM
sympmarc wrote:

Yes, the MSDN SDK is pretty confusing. However, it's beyond my pay grade to rewrite them! (Though I've tried my damndest to get someone at Microsoft to let me help improve them, with no success.)

If you look at the docs, though, GetListContentType "Returns the content type definition schema for the specified list content type.", in other words, it tells you abvout a particular Content Type available in the list. GetList "Returns a schema for the specified list.", which means it tells you about all of the columns and information available about the list.

If you are going to use the Web Services, unfortunately you'll need to become a good SDK spelunker.

M.

Shouldn't they be the same then? If the list is of the type specified o GetListContentType, then shouldn't both of these operations return the exact same thing? What I am thinking is that the List is an "instance" of the list type.. am I wrong here?

Also, how can I find fields of type folder in lists?

Coordinator
May 18, 2011 at 8:43 PM

No, lists can allow multiple Content Types and GetListContentType will show you the structure of only one of them. What you see in GetLists will be the superset of columns in all of the Content Types. Even if you only have one Content Type eabled, the two operations serve different purposes.

I think you may be confusing Content Types and List Templates.

A Folder is a Content Type, just like Item or Document.

M.