Is there a way to find out if a retrieved component is dynamic/publishable using core service ? I am not able to see any property that can tell me that .
Please help.
Tridion Stack Exchange is a question and answer site for Tridion developers and administrators. It only takes a minute to sign up.
Sign up to join this communityIs there a way to find out if a retrieved component is dynamic/publishable using core service ? I am not able to see any property that can tell me that .
Please help.
The component by itself can't be nor dynamic nor static, it's component presentation that can be dynamic. It's controlled by IsRepositoryPublishable
property per ComponentTemplateData
As user978511 noted, it's not the component which determines whether publishing is dynamic, but the component template. Using the core service, you can retrieve a ComponentTemplateData
object and check its IsRepositoryPublishable
property.
ComponentTemplateData
also has a RelatedSchemas
property, so with a bit more code you could find out whether a given component is based on a schema for which there is a dynamic template.
If there is at least one dynamic component template, you will be able to publish the component. Publishing the component will result in a component presentation being published for each of the dynamic component templates related to the schema.
If it is highly required to know if the component can be used as a DCP I can think of two ways to achieve this, though it will be pretty expensive operation.
CoreServiceClient.ResolveItems
should resolve the component if it has any dynamic component templates.Publication.Get(List)ComponentTemplates
and then checking if any of the templates is dynamic.