Examples Getting lists of items (.NET)
The Core Service has methods for retrieving lists of Content Manager items.
GetList(id, filter)
Gets a list of objects. This method is for items that are containers, or are contained in a container, such as Publications, Components, Pages, Folders, Keywords, Target Groups, Schemas, and so on. id is the ID of the container in which to search for items.
GetListXml(id, filter)
Gets a list of items in the form of an XML document. This method is for items that are containers, or are contained in a container, such as Publications, Components, Pages, Folders, Keywords, Target Groups, Schemas, and so on. id is the ID of the container in which to search for items.
GetSystemWideList(filter)
Gets a list of objects for system-wide item types, that is, item types not contained in a container. Examples of system-wide item types are Users, Target Types, and Workflow Processes.
GetSystemWideListXml(filter)
The same as GetSystemWideList, but gets a list of items in the form of an XML document.
The filter in all of these methods specifies exactly which items to retrieve. For GetListXml, this is a subclass of SubjectRelatedListFilterData, and in GetSystemWideList and GetSystemWideList, the filter is a subclass of SystemWideFilterData. Explore the Core Service API documentation (available online) to learn of specific filters.
Here are some examples of these methods being used to retrieve specific sets of items:
Getting all root Categories in a Publication
CategoriesFilterData filterData = new CategoriesFilterData();
filterData.IsRoot = true;
XElement resultXml = client.GetListXml(publicationId, filterData);
Getting all Components and Schemas in a Publication
RepositoryItemsFilterData filterData = new RepositoryItemsFilterData();
filterData.ItemTypes = new[]
{
ItemType.Component,
ItemType.Schema
};
filterData.Recursive = true;
XElement resultXml = client.GetListXml(publicationId, filterData);
Getting all Multimedia Components not based on one specific Schema
OrganizationalItemItemsFilterData filterData = new OrganizationalItemItemsFilterData();
filterData.ItemTypes = new[]
{
ItemType.Component
};
filterData.ComponentTypes = new[]
{
ComponentType.Multimedia
};
filterData.NotBasedOnSchema = new LinkToSchemaData()
{
IdRef = schemaId
};
XElement resultXml = client.GetListXml(folderId, filterData);
Getting all users in Content Manager, both as data objects and as XML
UsersFilterData filterData = new UsersFilterData();
IdentifiableObjectData[] resultData = client.GetSystemWideList(filterData);
XElement resultXml = client.GetSystemWideListXml(filterData);
Getting all active Workflow Processes being performed by one specific user, both as data objects and as XML
ProcessesFilterData filterData = new ProcessesFilterData();
filterData.ForPerformer = new LinkToUserData()
{
IdRef = userId
};
filterData.ProcessType = ProcessType.Active;
IdentifiableObjectData[] resultData = client.GetSystemWideList(filterData);
XElement resultXml = client.GetSystemWideListXml(filterData);
Getting all failed publish transactions that originate from one specific Publication, both as data objects and as XML
PublishTransactionsFilterData filterData = new PublishTransactionsFilterData();
filterData.ForRepository = new LinkToRepositoryData()
{
IdRef = publicationId
};
filterData.PublishTransactionState = PublishTransactionState.Failed;
IdentifiableObjectData[] resultData = client.GetSystemWideList(filterData);
XElement resultXml = client.GetSystemWideListXml(filterData);