9

The code snippet below successfully returns a list of items that have changed recently. Is there a way to include multiple search folders or do I need to do separate searches for that?

            string id = "tcm:2-2-2";
            folder.IdRef = id;
            filter.SearchIn = folder;
            filter.ModifiedAfter = Convert.ToDateTime("02/18/13");
            var results = client.GetSearchResults(filter);

2 Answers 2

12

From the Content Manager Core Service API Documentation the following search scopes are supported:

For searching system wide, leave SearchIn set to null

For searching within a Repository/Publication, set the value of SearchIn to that specific RepositoryData

For searching within an organizational item only (one level), set the value of SearchIn to that specific OrganizationalItemData and the value of SearchInSubtree to false

For searching within an organizational item and the entire subtree, set the value of SearchIn to that specific OrganizationalItemData and the value of SearchInSubtree to true

1
  • 1
    +1 and welcome to Tridion Exchange! Nice tips on how to search a whole publication or even the entire system. Commented Mar 6, 2013 at 22:49
9

As Tjo says you can search on elements at a top level, and get results recursively.

For example, the code below would give you an array of any items that have been modified in the last day, inside the folder tcm:95-1436-2.

It would also include items inside child folders of tcm:95-1436-2.

SearchQueryData searchQueryData = new SearchQueryData
{
    ModifiedAfter = DateTime.Now.AddDays(-1),
    SearchIn = new LinkToIdentifiableObjectData { IdRef = "tcm:95-1436-2" }
};
IdentifiableObjectData[] results = client.GetSearchResults(searchQueryData);
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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