1

Hello I'm using Tridion 2011 and I need to get all the components from a specific publication and based on a specific schema in C#. Does anyone knows how to do it? Thanks in advance.

1

You can do it using CoreService like:

var filter = new UsingItemsFilterData
{
   InRepository = new LinkToRepositoryData {IdRef = "%pubId%"}, 
   ItemTypes = new [] {ItemType.Component }
};

var list = ClientAdmin.GetList("%schemaId%", filter);
| improve this answer | |
1

Not sure why you want to do that and where you want to do that (in TBB or Custom application or just want to review/make a list of those items for something). Apart from above answer which seems absolutely fit for the purpose if you want to do that in a custom application for some custom business logic. There are another way you can do thats:

  • Use Advanced Search in CME - and select the publication, type of item and based on Schema to get a list of items:

enter image description here

  • Further, you can choose to save this filter/query as a Virtual Folder - which you can access similar to a Folder listing all items based on your query. Also, you can code to read the content of this Virtual Folder using Core Service (in custom applications) or using TOM.NET API (in TBBs or Event System)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.