-1

我必须创建一个自定义页面,其中包含所有页面的列表及其在出版物中的发布日期。有人可以指导我如何使用此代码在自定义页面中获取发布日期吗?

private ItemType GetTridionItemType(RepositoryLocalObjectData source)
{
    string itemType = source.GetType().Name;
    switch (itemType)
    {
        case "PageData":
            return ItemType.Page;
    }
    return ItemType.UnknownByClient;
} 

private string CreateNewItemCopy(string title, RepositoryLocalObjectData source, 
                                 string filename)
{
    ItemType tridionItemType = GetTridionItemType(source);
    string orgItemUri = source.LocationInfo.OrganizationalItem.IdRef;
    var newItem = client.Copy(source.Id, orgItemUri, true, new ReadOptions());
    newItem.Title = title;
    if (tridionItemType == ItemType.Page)
    {
        PageData pageData = newItem as PageData;
        pageData.FileName = filename;
        client.Update(pageData, new ReadOptions());
    }
    else
    {
        client.Update(newItem, new ReadOptions());
    }

    return newItem.Id;
}
4

2 回答 2

5

我们可以从 coreservice 获取发布信息

TridionGeneration Generation = new TridionGeneration();
            Generation.Settings = GetImportSetting();
            var objclient = new CoreService2010Client();
            objclient.ClientCredentials.Windows.ClientCredential.UserName = Generation.Settings.Username;
            objclient.ClientCredentials.Windows.ClientCredential.Password = Generation.Settings.Password;
            objclient.Open();
            Generation.client = objclient;
           

            var objectList = Generation.client.GetListPublishInfo([object tcm uri]);

于 2012-09-04T04:55:03.997 回答
3

PublishEngine.GetPublishInfo 返回项目的发布信息。其中包含发布日期。(PublishInfo.PublishedAt)。

您还可以使用 CoreService.GetListPublishInfo。

于 2012-09-03T13:52:34.403 回答