2

I am creating a PowerShell script which traverses through the CMS Structure Group and gets individual Page TCM id which was published from the Publication.

I am able to get the list of the Pages which are published using the script. I am not able to get the version of the page which was published.

I want to publish that particular version of the Page using the PowerShell script

Sample Script:

        #Create SearchQueryData to Query the Pages publication wise and filter with isPublished 
        $filter = New-Object SearchQueryData
        $filter.BaseColumns += @([Tridion.ContentManager.CoreService.Client.ListBaseColumns]::Extended)

        $filter.ResultLimit = 1000
        $filter.ItemTypes += @([Tridion.ContentManager.CoreService.Client.ItemType]:: Page)
        #Checking if the page is published
        $filter.IsPublished = "True"

        $filter.SearchIn = New-Object LinkToIdentifiableObjectData

        $filter.SearchIn.IdRef =  "TCMID_OF_STRUCTURE_GROUP"#$SystemWideItem.ID
        $filter.SearchInSubtree = $true                    
        #Get Page list based on the publication id and SearchQueryData filter                

        $temp =  0
        #Creating the search node object to capture the result set 
        $xname = [System.Xml.Linq.XName]"SerachNode$temp"
        $smlem = new-Object System.Xml.Linq.XElement $xname

        $smlem = $client.GetSearchResultsXml($filter)
        foreach($node in $smlem.Nodes())
        {
            #$node
            Write-Host "TCM ID:" $node.Attribute(“ID”).Value
            $subtype= $node.Attribute(“SubType”).Value
        }

1 Answer 1

3

You cannot publish a particular version of an item (Page or Component). The system will always publish the latest checked-in version! (not 100% true, as you can publish in-Workflow versions (but I don't want to complicate the answer too much)).

If you wish a certain version of an item to be published, you must roll back ("roll forward") said item to the desired version, and publish it afterwards.

As for getting the information about what version was published, you could do it by cross referencing the item's published date and the item's version history. The version which corresponds to the point of time when the item was published is the version you are looking for. Note that this can differ between Publications and even Purposes (depending where the item was published).

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.