When extending the Tridion event system, using the following code:
EventSystem.Subscribe<Component, UnPublishEventArgs>(OnComponentUnPublishForInit, EventPhases.Initiated);
private static void OnComponentUnPublishForInit(Component component, UnPublishEventArgs unpublishEvent, EventPhases phase){...}
in the OnComponentUnPublishForInit
method, how can I get information about if the Component which will be unpublished, is being used by others? And if it is used by others, how can I make this unpublish event fail, and give some information to the Tridion system?
An example, there is Component A, and component B. A contains B (A has a reference to B), A is published, B is published. When trying to unpublish B, A is already published and it has a reference to B, so B should not be unpublished. Can I get the information that A has a reference to B?