I am using CoreService2010Client
, I am iterating through a list of TCM ID values I have and either localizing it or unlocalizing it. Sometimes the item is already localized, so when I call client.Localize();
, it throws an exception saying "The item is localized.".
How do I test the state of the component (localized or not-localized) before I try to change it?
First you will need to open a ComponentData object as follows:
ComponentData usedComponentData = (ComponentData)client.Read(uriUsedItem, new ReadOptions());
Then check usedComponentData.BluePrintInfo.IsLocalized which will return a Boolean value