This project has moved. For the latest updates, please go here.



Web Service





  • This operation accepts a webURL option. This allows you to change the context for the operation to a different site. Using a GUID for the listName does NOT change the context as it does with the Object Model, so you need to use the webURL option as well if your list is in a different site.


This is an example from jenglish. I wrote a blog post about this example as well. 

If you have a better, real life example, please post it in the Discussions.

var queryStringVals = $().SPServices.SPGetQueryString(); // The SPGetQueryString function parses the Query String values out into an array
var contentTypeIdValue = queryStringVals["ContentTypeId"]; // This grabs the value of the ContentTypeId Query String parameter
var contentTypeName = ""; // Define a variable to hold the name of the Content Type

// Get the list's Content Types
  operation: "GetListContentTypes", // See the MSDN SDK at for details on this operation
  listName: $().SPServices.SPListNameFromUrl(), // The SPListNameFromUrl function gets the list name for the current context based on the URL
  async: false, // We'll do this asynchronously
  completefunc: function (xData, Status) {
    $(xData.responseXML).find("ContentType").each(function() { // All of the list's Content Types will be returned. We'll loop through to get the one we are interested in
      if($(this).attr("ID") == contentTypeIdValue) { // If the contentTypeId matches...
        contentTypeName = $(this).attr("Name"); // the name in our variable...
        return false; // ...and return false, which breaks us out of the loop. (We've found what we need, so no reason to continue looking.)
//... do something with the Content Type Name ...

Last edited Jan 13, 2012 at 4:23 PM by sympmarc, version 5


gmajsterek Aug 20, 2015 at 1:36 PM 
Thanks, thats useful but how can i get parent content types? Please help.

BenJamN Apr 29, 2013 at 5:41 PM 
Awesome! Just what I'm looking for. Thanks Marc.