5

I need to find publication ID of publication from where page is getting saved through event system page save event. I tried to get publication ID through owning/context publication property but not able to get the correct publication ID and both are give publication id where we have created page i.e Masterwebsite

All page are created at 050 level but editing a page from 080 level, while trying to get publication ID through owning/context publication its giving same 050 level publicatin ID. But for our case we need to get publication ID of 080 level if this is not possible through these properties then how to achieve this.

Thanks Nash

1
  • My page is localized at 080 level, its at 050 level only but I am saving page from 080 level.
    – Nash
    Mar 4, 2015 at 5:34

2 Answers 2

4

Just do:

var pubId = Page.Id.ContextRepositoryId 

or

var pubId = Page.Id.PublicationId 

and then:

var publicationId = new TcmUri(pubId, ItemType.Publication);

This is the lightest method as you already have publication Id in TcmUri of page, for example your page id is: tcm:5-6-64. The publication Id will be: tcm:0-5-1. So TcmUri class helps you get advantage of this without even talking to Tridion server.

1
  • 1
    Page.ContextRepository.Id should also give the same TCM URI Mar 3, 2015 at 18:24
1

Is your page localized at the 080 level?

Unless the page has been localized it is still edited and saved at the parent level regardless of where it was opened from.

Your Answer

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

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