5

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.

  • Consider flipping the requirement by starting with a dynamic template rather than the items, especially if you want this information for many components. – Alvin Reyes Aug 27 '13 at 8:04
8

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

| improve this answer | |
  • +1. We publish pages and component presentations rather than components. – Alvin Reyes Aug 26 '13 at 17:11
4

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.

| improve this answer | |
  • 1
    Or you can publish the dynamic template(s) itself apart from Pages and components – Rohan Gadiya Aug 26 '13 at 17:41
2

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.

  1. CoreServiceClient.ResolveItems should resolve the component if it has any dynamic component templates.
  2. This is a two step approach, first getting a list of component templates using Publication.Get(List)ComponentTemplates and then checking if any of the templates is dynamic.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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