Take the community feedback survey now.
Take the community feedback survey now.
Thanks Russell, that would seem like the right thing to do then.
Is there some way I can track the issue? I don't have access to support since I'm not certified yet...
One option is to intercept the IDataImporter interface and replace SaveAction for copy operations, something like:
using EPiServer.Core;
using EPiServer.DataAccess;
using EPiServer.Enterprise;
using EPiServer.Framework;
using EPiServer.ServiceLocation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
namespace EPiServerSite4
{
[InitializableModule]
public class NotPublishedCopyModule : IConfigurableModule
{
public void ConfigureContainer(ServiceConfigurationContext context)
{
context.Services.Intercept<IDataImporter>((s, d) => new NoPublishOnCopyDataImporter(d));
}
public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context){}
public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context){}
}
public class NoPublishOnCopyDataImporter : IDataImporter
{
private IDataImporter _defaultImporter;
public NoPublishOnCopyDataImporter(IDataImporter defaultImporter)
{
_defaultImporter = defaultImporter;
}
public void Abort()
{
_defaultImporter.Abort();
}
public ITransferLog Import(Stream stream, ContentReference destinationRoot, ImportOptions options)
{
if (options.TransferType == EPiServer.Core.Transfer.TypeOfTransfer.Copying)
options.SaveAction = SaveAction.CheckOut | SaveAction.SkipValidation;
return _defaultImporter.Import(stream, destinationRoot, options);
}
public IImportStatus Status
{
get { return _defaultImporter.Status; }
}
}
}
Thanks Johan, I will try that if this is not picked up as a bug by Episerver...
Thanks Russell, for your help.
I'm gonna talk to our product owner about this... see what we can do.
A simple way to copy a published page without publishing it is to use project. You create a Project, make sure that it active and selected before you start pasting. From then, any content you copy&paste from 1 folder to another will be a new content without Published date.
I noticed that, if you copy a published page, the copy is automatically published as well.
In my opinion, this is unwanted behaviour since it creates duplicate content on your website.
I want to create an InitializableModule to fix this, but I'm wondering how I can detect that a page is new and is a copy of another page.
And should I just cancel the publish event or is there some kind of property that I can set that will prevent the page from being published in the first place?