11

I have a console app that is using the Core Service to try and retrieve localized and local components for a given publication Id. I've had a look at the documentation on SDL Live Content and have managed to get as far as the following:

using (var client = new BlueprintReports.CoreService.CoreServiceClient("basicHttp"))
{
    var filterdata = new RepositoryItemsFilterData();
    filterdata.Recursive = true;
    filterdata.ItemTypes = new[] { ItemType.Component };

    XElement resultxml = client.GetListXml(_publicationId, filterdata);
    if (resultxml != null)
    {
        foreach (var component in resultxml.Elements())
        {
            var compData = (ComponentData)client.Read(component.Attribute("ID").Value, 
                                                      new ReadOptions());
            if (compData.BluePrintInfo.IsLocalized == true)
            {
                Console.WriteLine(component.Attribute("ID").Value);
            }
        }
    }
    Console.Read();
}

What the above code is doing is writing out the tcm Id of each localized component. However what I also need to do is check against local components i.e. components that have been created at the specific publication (_publicationId in the above example).

Does anyone know if this is possible?

1 Answer 1

13

Edit: just re-read your question:

if (compData.BluePrintInfo.IsShared == false)
{
     Console.WriteLine(component.Attribute("ID").Value);
}

That should print for Components local to the current context publication and those that have been localized.

1
  • Thanks Rob, I now just have a check for IsShared == false as it will always fall back to local/localized items. Apr 6, 2013 at 18:13

Your Answer

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

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