AI OnAI Off
what do you want to check? is the name change only affected the page name, or even with the properties in the pages? do you just want to flag the pages that need to be reviewed, or do you want to do a find and replace?
you can always use IContentRepository to load the content recursively those. or Find
I am thinking a find and replace, with some reporting so they know what changes are being made. It would be in page titles and page content.
Hey Paul, why not create a schedule job to execute your code? Within that use Quan's suggestion of IContentRepository to load your content, replace your company name text and then republish it.
Here some code you can use
Reading "Episerver Commerce: A problem - solution approach" | Leanpub
public virtual IEnumerable<T> GetEntriesRecursive<T>(ContentReference parentLink, CultureInfo defaultCulture) where T : IContent
{
foreach (var nodeContent in LoadChildrenBatched<IContent>(parentLink, defaultCulture))
{
foreach (var entry in GetEntriesRecursive<T>(nodeContent.ContentLink, defaultCulture))
{
yield return entry;
}
}
foreach (var entry in LoadChildrenBatched<T>(parentLink, defaultCulture))
{
yield return entry;
}
}
private IEnumerable<T> LoadChildrenBatched<T>(ContentReference parentLink, CultureInfo defaultCulture) where T : IContent
{
var start = 0;
while (true)
{
var batch = _contentLoader.GetChildren<T>(parentLink, defaultCulture, start, 50);
if (!batch.Any())
{
yield break;
}
foreach (var content in batch)
{
// Don't include linked products to avoid including them multiple times when traversing the catalog
if (!parentLink.CompareToIgnoreWorkID(content.ParentLink))
{
continue;
}
yield return content;
}
start += 50;
}
}
Hi all,
We have over 1000 pages that will need to be checked as the company is going through a name change.
Wondering if anyone has gone through a global company name change and can provide the best way to update it programmatically? or any available plugins.
Thanks in advance.
Paul