Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tridion : How can I find out if a page has been published to a particular publication target using the business connector?

Tags:

c#

tridion

I am using Tridion release 5.3.

Using the business connector I want to find out if a page has been published to a specific publication target.

Using the TOM API I can do

// using types from Tridion.ContentManager.Interop.TDS
// and Tridion.ContentManager.Interop.TDSDefines
TDSE tdse = new TDSE();
Page page = (Page)tdse.GetObject(itemUri, EnumOpenMode.OpenModeView, 
                                 "tcm:0-0-0", XMLReadFilter.XMLReadAll);
page.IsPublishedTo(tcm);

If I query Tridion using the business connector the only information I get is if the page has been published, but not to which targets.

I have tried querying the publication target itself but this give no information as to which pages it has published.

Any ideas?

like image 398
Kevin Brydon Avatar asked Feb 22 '12 12:02

Kevin Brydon


2 Answers

You should set XMLReadPublishInfo and XMLReadPublishInfoDetails ItemFilters:

<tcmapi:Message xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI"
                version="5.0" from="[MDVC.js][CmdsExecute]" failOnError="false">
<tcmapi:Request ID="tcm:1010-8314-64" preserve="true">
    <tcmapi:GetItem itemURI="tcm:1010-8314-64" openMode="OpenModeView">
        <tcmapi:ItemFilter type="XMLReadPublishInfo" />
        <tcmapi:ItemFilter type="XMLReadPublishInfoDetails" />
    </tcmapi:GetItem>
</tcmapi:Request>

This will return all the publish info and from there on you will have to filter it yourself. Here's example reply:

<tcmapi:Message xmlns:tcmapi="http://www.tridion.com/ContentManager/5.0/TCMAPI"
               version="5.0" from="[MDVC.js][CmdsExecute]" failOnError="false">
<tcmapi:Response ID="tcm:1010-8314-64" success="true" actionWF="false">
  <tcmapi:Request ID="tcm:1010-8314-64" preserve="true">
    <tcmapi:GetItem itemURI="tcm:1010-8314-64" openMode="OpenModeView">
      <tcmapi:ItemFilter type="XMLReadPublishInfo" />
      <tcmapi:ItemFilter type="XMLReadPublishInfoDetails" />
    </tcmapi:GetItem>
  </tcmapi:Request>
  <tcmapi:Result>
    <tcm:Page ID="tcm:1010-8314-64" IsEditable="false"
              xmlns:tcm="http://www.tridion.com/ContentManager/5.0"
              xmlns:xlink="http://www.w3.org/1999/xlink">
      <tcm:Info>
        <tcm:PublishInfo>
          <tcm:IsPublished>true</tcm:IsPublished>
          <tcm:PublishState>
            <tcm:Publication xlink:type="simple" xlink:title="Web: "
                             xlink:href="tcm:0-1010-1" />
            <tcm:PublicationTarget xlink:type="simple" xlink:title="A"
                                   xlink:href="tcm:0-143-65537" />
            <tcm:Date>2006-01-30T11:22:58</tcm:Date>
            <tcm:Publisher xlink:type="simple" xlink:title="NA\A085159"
                           xlink:href="tcm:0-220-65552" />
          </tcm:PublishState>
        </tcm:PublishInfo>
      </tcm:Info>
    </tcm:Page>
  </tcmapi:Result>
</tcmapi:Response>

like image 165
Andrey Marchuk Avatar answered Nov 04 '22 04:11

Andrey Marchuk


For a quick check here is what I would do.

  1. Set the CMS into debug mode.
  2. Open the page in question
  3. Do show where used in the GUI.
  4. Switch to the "Published To" tab 5) After step 4 do not click anything, but the debug window icon. Grab the BC XML request you see it there and update the parameters such as the page id etc. and make the request using BC for your pages.

Above should work.

like image 40
3 revs, 3 users 67% Avatar answered Nov 04 '22 03:11

3 revs, 3 users 67%