We have some components marked as published to publication targets, but the publication target does not exist anymore.
This causes problem when you want to delete the pages that are published to this target (maybe because of data migration, they still think they are living on a remote server) :)
We cannot delete them, as they marked as published!
Possible solution:
First I played a bit with the core services.
Then I used this code to clean:This causes problem when you want to delete the pages that are published to this target (maybe because of data migration, they still think they are living on a remote server) :)
We cannot delete them, as they marked as published!
Possible solution:
First I played a bit with the core services.
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="basicHttp" maxReceivedMessageSize="10485760""> <readerQuotas maxStringContentLength="10485760" maxArrayLength="10485760"/> <security mode="TransportCredentialOnly"> <transport clientCredentialType="Windows"/> </security> </binding> </basicHttpBinding> <wsHttpBinding> <binding name="wsHttp" transactionFlow="true" maxReceivedMessageSize="10485760"> <readerQuotas maxStringContentLength="10485760" maxArrayLength="10485760"/> <security mode="Message"> <message clientCredentialType="Windows"/> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint name="Basic_CoreServiceDev" address="http://yourtridionserver/webservices/CoreService2013.svc/basicHttp" binding="basicHttpBinding" bindingConfiguration="basicHttp" contract="Tridion.ContentManager.CoreService.Client.ICoreService"/> <endpoint name="CoreServiceDev" address="http://yourtridionserver/webservices/CoreService2013.svc/wsHttp" binding="wsHttpBinding" bindingConfiguration="wsHttp" contract="Tridion.ContentManager.CoreService.Client.ISessionAwareCoreService"/> </client> </system.serviceModel>
using (var client = new SessionAwareCoreServiceClient("CoreServiceDev")) { if (client.ClientCredentials != null) client.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential( ConfigurationManager.AppSettings["Username"], ConfigurationManager.AppSettings["Password"]); client.SetSessionTransactionTimeout(60 * 30); //30 minutes Console.WriteLine("Please enter the tcm-id of the publication"); var tcmid = Console.ReadLine(); try { Console.WriteLine("Started"); client.DecommissionPublicationTarget(tcmid); Console.WriteLine("Completed"); client.SetSessionTransactionTimeout(60); } catch (Exception ex) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Error: " + ex.Message); Console.ResetColor(); } }
The result was still a time-out!
At the end, running the powershell on the server was a better option: (tcm id is the publication target's tcm-id):
PS C:\Windows\system32> Import-Module Tridion.ContentManager.Automation
PS C:\Windows\system32> Clear-TcmPublicationTarget tcm:0-2-12345
PS C:\Windows\system32> Clear-TcmPublicationTarget tcm:0-2-12345
No comments:
Post a Comment