SaaS CMS has officially launched! Learn more now.

Update catalog content


When I try to run this code I get an exception on the last row.

    var referenceConverter = ServiceLocator.Current.GetInstance();
    var contentRespository = ServiceLocator.Current.GetInstance();

    var catalog = contentRespository.GetDefault(referenceConverter.GetRootLink());
    catalog.Name = "Snafu";
    catalog.DefaultCurrency = "SEK";
    catalog.DefaultLanguage = "en";
    catalog.WeightBase = "kgs";
    var link = contentRespository.Save(catalog, SaveAction.Publish, AccessLevel.NoAccess);

    catalog = (CatalogContent) contentRespository.Get(link).CreateWritableClone();
    contentRespository.Save(catalog, SaveAction.Publish, AccessLevel.NoAccess);

Message is: "The provided content link does not have a value. Parameter name: contentLink"

What am I doing wrong?

Nov 04, 2014 11:17

Your code looks correct. Did you try to see if the catalog is created and displayed corrected?


Nov 04, 2014 12:05

Yes, the catalog is saved and is correct. I just can't update it...

Nov 04, 2014 13:23

Does it work if you do the changes interactively through the Catalog UI?

Nov 05, 2014 11:56

Yes, it's just when updating using the API that it doesn't work.

Nov 05, 2014 13:40

I actually have the same error.

2014-10-22 17:48:22,165 [956] ERROR EPiServer.DataAbstraction.ScheduledJob: Job failed
System.ArgumentNullException: The provided content link does not have a value.
Parameter name: contentLink
   at EPiServer.Core.DefaultContentLoader.Get[T](ContentReference contentLink, LoaderSettings loaderSettings)
   at EPiServer.Commerce.Validation.MissingStartingPointLanguageValidator.<>c__DisplayClass2.<ShouldShowWarning>b__1(ICommerceRouter route)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at EPiServer.Commerce.Validation.MissingStartingPointLanguageValidator.ShouldShowWarning(CatalogContentBase content)
   at EPiServer.Commerce.Validation.MissingStartingPointLanguageValidator.Validate(CatalogContentBase instance)
   at EPiServer.Validation.ValidationService.ValidateRecursively(Object instance, HashSet`1 visitedInstances)
   at EPiServer.Core.ContentProvider.Validate(IContent content, SaveAction action)
   at EPiServer.Core.DefaultContentRepository.Save(IContent content, SaveAction action, AccessLevel access)

We have tracked down this method, it might be releated, one of the routers returns null for RoutingStartingPoint:

private IEnumerable<ICommerceRouter> GetCommerceRouters()
    if (_commerceRouters == null)
         commerceRouters = partialRouteHandler.GetIncomingRouters(typeof(PageData))
                                    .OfType<PartialRouter<PageData, CatalogContentBase>>()
                                    .Select(x => x.Router)

    return _commerceRouters;
Nov 05, 2014 20:19

Interesting. Do you have a test case to reproduce the bug?



Nov 06, 2014 7:42

Not really. Everything fails, even just updating the name of a catalog item from code. Everything works fine from the Catalog Manager though.

Nov 06, 2014 8:10

In this case my vague suggestion would be a close look on how routes are registered. Can you post your code here?


Nov 06, 2014 8:21

Wer're just calling CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false); in a IConfigurableModule

Nov 06, 2014 8:35


We're also experiencing this when trying to update catalog content from a scheduled job. Same code more or less.

BR Jens

Nov 15, 2014 9:23

In that case I highly recommend you to contact our Developer service, so we can properly diagnose your problem. This sounds serious enough to take action, but without a reproducable case we won't be able to fix.



Nov 18, 2014 10:51

Is this solved? What is solution?

Edited, Jan 23, 2015 13:33

Seems like the problem was regarding the routing. Two workarounds seemed to work.

One was to remove:
CatalogRouteHelper.MapDefaultHierarchialRouter(RouteTable.Routes, false);
from the initialization.

The other was to add the host "*" in "Manage Websites".

I don't know if EPiServer has done anything more about this. It seems like a weird error and the error message is pretty bad at telling you what you're doing wrong.

Jan 23, 2015 14:40

Thanks. Wildcard works.

P.S. But it is weird that if you want to save some existing catalog entry, you need routing to work.

Jan 23, 2015 14:48

@Erik: We have bug 120803 to make the error message more meaningful/helpful.

The bug is likely to be released in Commerce 8.9



Jan 26, 2015 4:16
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.