有没有快速删除大型工作流程历史堆栈的方法?

Vin*_*gat 7 tridion

是否有任何快速方法/技巧可以删除工作流程历史记录中的大约85K条目?从GUI尝试提出存储问题,并解决此问题需要反弹框.

在很长一段时间后,尝试PowerTool也会崩溃.想要问更广泛的社区.感谢你的想法.

谢谢Vin

Nun*_*res 4

Tridion 是哪个版本?2011年?

您可能可以使用一个定期为您执行此操作的 CoreService 客户端应用程序。我认为“PowerTool”是指清除工具吗?

另外 - 我可能会就您看到的错误联系客户支持,似乎使用 GUI 或清除工具不会失败。

如果您使用的是 2011 SP1,您可以使用以下代码:

using System;
using System.ServiceModel;
using System.Xml;
using Tridion.ContentManager.CoreService.Client;

namespace DeleteWorkflowHistory
{
    class Program
    {
        private const string NetTcpEndpoint = 
            "net.tcp://localhost:2660/CoreService/2011/netTcp";
        private static readonly EndpointAddress EndpointAddress =
            new EndpointAddress(NetTcpEndpoint);

        static void Main(string[] args)
        {
            var binding = new NetTcpBinding 
            { 
                MaxReceivedMessageSize = 2147483647 
            };

            var quota = new XmlDictionaryReaderQuotas
            {
                MaxStringContentLength = 2147483647,
                MaxArrayLength = 2147483647
            };
            binding.ReaderQuotas = quota;
            var client = new SessionAwareCoreServiceClient(binding, EndpointAddress);
            Log("Connected to Tridion Content Manager version: " + client.GetApiVersion());
            ProcessesFilterData filter = new ProcessesFilterData
            {
                BaseColumns = ListBaseColumns.IdAndTitle,
                ProcessType = ProcessType.Historical
            };
            foreach (IdentifiableObjectData data in client.GetSystemWideList(filter))
            {
                var processHistory = data as ProcessHistoryData;
                if (processHistory != null)
                {
                    Log("Deleting history: " + processHistory.Id + " / " + processHistory.Title);
                    client.Delete(processHistory.Id);
                }
            }
            client.Close();
        }

        private static void Log(string message)
        {
            Console.WriteLine(string.Format("[{0}] {1}", DateTime.Now.ToString("HH:mm:ss.fff"), message));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)