When using core services, how do you localize or not block the component without a fatal error when the element is already in this state?

I use CoreService2010Client

, I iterate over the list of TCM id values ​​that I have and either localize it or not highlight it. Sometimes the element is already localized, so when I call client.Localize();

it throws an exception that says "The element is localized."

How can I check the state of a component (localized or not localized) before trying to change it?

+3


source to share


1 answer


First, you need to open a ComponentData object like this:

ComponentData usedComponentData = (ComponentData) client.Read (uriUsedItem, new ReadOptions ());



Then check usedComponentData.BluePrintInfo.IsLocalized which will return boolean

+4


source







All Articles