9

I'm using Component.IsPublishedInContext to determine if the Component is published but the value returns true irrespective of the current TargetType where the Component is being published to.

Example:

  1. Component is Published as a DCP to "Staging"
  2. Component is NOT Published to "Live"
  3. Component.IsPublishedInContext returns true when being executed on "Live"

How do I figure out if the Component is published to "Live"?

1
  • Welcome to Tridion stack exchange.. :) Commented Mar 25, 2013 at 14:49

1 Answer 1

8

Welcome to the Tridion Stack Exchange.

Can you let us know which version of Tridion you are using please?

If you are using Tridion 2011, then I think that this has already been answered (by Bart) in Rob's "Tridion 2009 TBB: How do I determine if a Page is published to particular publication target?" question over on Stack Overflow here.

The PublishEngine.IsPublished(IdentifiableObject item, PublicationTarget publicationTarget, bool isPublishedInContext) method should give you this.

If you are using Tridion 2009, then Ryan's accepted answer on the same question should work.

1
  • 2
    Hi Jonathan, I am using Tridion 2011 SP1 and yes using PublishEngine.IsPublished solved my problem! Thank you!
    – Kunal
    Commented Mar 25, 2013 at 8:13

Your Answer

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

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