So, I need to get a list of the content types applied to a library. The Lists webservice has a call for this:
So, I’m connected to a site, I supply a list name to identify the list… …but what do I give as a contentTypeId? I don’t have a f$%king clue – I was calling this function to try to find out what content types were valid!
Well, good news. It doesn’t seem to matter what you put in, you always get a list of all the content types on the list. I used the following code…
WS_Lists.Lists lsts = new WS_TestApp.WS_Lists.Lists();
lsts.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlNode node = lsts.GetListContentTypes(libraryName, contentTypeID);
I figured that maybe they wanted the base content type for what I wanted back, so I tried setting
contentTypeID to documents (0x0101) and got back a list of all the content types. I then set
contentTypeID to “fish”, and still got back a list of all the content types. As far as I can tell, the second parameter doesn’t do anything.
Side note: The first content type returned is your default content type.
Side note 2: There doesn’t seem to be an easy way of identifying non-visible content types…