7

如何获取项目上次发布的日期/时间。

我试图为 PublishInfoData 创建对象以便使用 PublishedAt。

  PublishInfoData pobj = csClient.Read(pageTCMID, readoptions) as PublishInfoData;

但这会产生错误,例如无法将 IdentifiableObjectData 转换为 PublishInfoData。

请建议。

4

2 回答 2

8

这将为您提供所有发布信息:

csClient.GetListPublishInfo(pageTCMID);

然后你必须选择最新的:

var publishInfo = csClient.GetListPublishInfo(pageTCMID);
var lastPublishedAt = publishInfo.OrderByDescending(pi => pi.PublishedAt).First().PublishedAt;
于 2012-10-23T14:45:54.307 回答
0

我为记录添加了这个 Powershell 代码以获取页面的最后发布日期

Set-TridionCoreServiceSettings sdswpap004 2013-SP1
$client = Get-TridionCoreServiceClient

Write-Output "Getting the title"
$pageTitle = Get-TridionItem -Id "tcm:30-7386-64" | Select-Object Title
Write-Output $pageTitle

$publishInfo = $client.GetListPublishInfo("tcm:30-7386-64")



if ($publishInfo) {
    Write-Output "Getting the last pablished date: "
    Write-Output $publishInfo.PublishedAt | Out-String
}
于 2015-04-30T10:12:58.517 回答