• Deleting old content versions using the API
    Description Sometimes the episerver configuration attribute uiMaxVersions does not work, it is instead possible to use IContentVersionRepository to delete older content versions.  Resolution The example below is only for one content item. The code could be developed further to loo...

  • Enable special characters in URL Segment
    Description There's a default validation for URL Segment when a page is created which replaces special characters with the normal ones (for example ä becomes “a”). In some cases, clients want to keep those special characters in the URLs for their non-English versions of the web site. ...

  • How to stop a custom job in Admin UI in case your job has a loop.
    Description There are some partner developers followed this article http://world.episerver.com/documentation/developer-guides/CMS/scheduled-jobs/  to stop a job in admin UI. According to this post, a basic scheduled with the possibility to stop a job by overriding Stop method, so this metho...

  • How to get direct link to page in edit mode
    Description This article describes how to get a direct link to a page in edit mode using the Episerver API. This may be useful for developing a custom report. Resolution When looking for a link like the example below http://localhost:17000/Internal/UI/CMS/?language=sv#context=epi....

  • 'System.ArgumentNullException' occurred in Newtonsoft.Json.dll
    Description This article describes a cryptic error that can be thrown from any Episerver API and how to troubleshoot it. The complete error message can be seen below. An exception of type 'System.ArgumentNullException' occurred in Newtonsoft.Json.dll but was not handled in user codeAddition...

  • How to Return JSON for Episerver Form by Sort Order
    Description This article illustrates the code to return the JSON for an Episerver Form by a specified sort order. Resolution The code below can be found in full here. var formIden = new FormIdentity(formGuid, (content as ILocalizable).Language.Name); var friendlyNames = _formReposit...

  • Cannot programmatically set modified date
    Description Is it possible to update modified date of the page programmatically no matter when page is changed or published. When assigning "SetChangedOnPublish" as true and a date is set, when the content is updated, the current date and time are set instead of the value which wa...

  • How To Get Page Revisions For An Episerver Page
    Description This articles provides a discussion and a sample to pull a page revision for an Episerver page. Resolution It may be necessary to retrieve certain versions of page content. The IContentRepository or IContentLocator will always return the latest version of the content. ...

  • Length of a LongString property makes the site down
    Description Timeout error and the following message appear when opening some pages: "Array dimensions exceeded supported range." Using SQL profiler to find that some queries takes more than 30 seconds. The actual execution time is up to 5 minutes.  exec netContentLoadLongString @L...

  • PropertyList collection in editor not rendering when model includes CategoryList property
    Description The article describes an issue when the editor for the CategoryList property does not render at all. The Chrome network panel when rendering shows an http 500 error when viewing the All properties view for the content with the CategoryList property in the CMS editor. GET http://...

  • Loop Through Languages of a Page
    Description Below is a code sample of how to loop through language versions of a page. Resolution foreach (var pageLanguage in pageTypeData.ExistingLanguages){    var repository = ServiceLocator.Current.GetInstance<IContentLoader>();    var test1 = repository.Get<PageData...

  • Uncaught Reference Error: $ is not defined
    Description When not logged into EpiServer JavaScript does not seem to run and a "Uncaught Reference Error: $ is not defined" is found in the developer consul but the JavaScript runs fine when logged in. Resolution This is caused by jQuery not being loaded. When logged i...

  • How to add a media item via the API
    This sample illustrates how to add a media block type to the CMS. This assumes you have a Article page type but really you just need to pass in a ContentLink to the location you want to save the file to.  Resolution Below are some sample methods to add a new blob and insert data...

  • Find UnifiedSearch() Sample Template
    DescriptionThis is a sample template that uses Find and UnifiedSearch() to return the results.ResolutionCode Download To use, unzip into the site root and browse to the page.http://mysite.com/UnifiedSearchTest.aspx?query=alloy This was tested on Alloy 10.x.

  • How to get all languages tied to a fallback language
    This article contains the code segment that can retrieve all languages tied to a fallback language configured in the cms. Resolution ContentLanguageSettingsHandler.Instance.Get(ContentReference.StartPage).Where(s => s.LanguageBranchFallback.Contains("de", StringComp...