Episerver Api Explained

Getting content in and out of Episerver is one of the most frequent tasks you will do on every project.  This section I’ll cover APIs like the IContentRepository, used to get content from Episerver.  My guides cover the APIs you’ll need to use the most, Episerver also has full SDK documentation here which is worth reading.

EPiServer : How To Get Unpublished Child Pages With Meta Data

I've recently taken over a project that was developed by a third party company.  The site uses a number of hub/stack pages to pull in child pages to make up the page content to automatically create page placeholders from a side nav.  We had an issue [...]

EPiServer : Getting a Page from an Id

Epi Server 7 var pageId = 1; var pageRef = new PageReference(pageId); var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>(); var page = contentRepository.Get<PageDa[...]

How to get a page in EPiServer 7 ?

 How To Get An EPiServer Page Via the API In EPi7 you can still use the traditional call to the API, however, this way isn't classed as best practice anymore. var startpage = DataFactory.Instance.Get<PageData>(ContentReference.StartPage); [...]

EPiServer 7 : How do I get the "CurrentPage" from a controller ?

I've had a few instances where I've needed to get the current page in a block controller or from an ActionFilter, so I thought I'd add a link to say: Getting A Page Reference var pageRouteHelper = EPiServer.ServiceLocation.ServiceLocator.Current.Ge[...]

Generating a friendly URL within your EPiServer MVC View

SEO friendly URLs are essential to improve the usability and accessibility of your website, also by hiding your Page Id's from your customer, you're adding an extra layer of security by not leaking any of your internal Episerver data.  A page ID isn'[...]

How to get a reference to the start page or root page?

Getting a page or content reference to some of the basic Episerver functionality is extremely easy and is given to you out of the box.  Below shows you how to get a reference to the start page, root page and the block folder. EPiServer.Core.Conte[...]

How to get the page URL of a specific Episerver page?

Generating links and anchor tags to other areas within your website is a very common requirement in a project, and luckily, the EPi API makes it very easy to do.  There are several ways to ge the current page Url, so here goes: To get the current pag[...]

Get friendly Url of a page in EPiServer

There are several ways of getting a Url for a page.  If you want to get a friendly Url from a view, then I would strongly recommend reading this post to see all the options available to you: Creating a friendly URL within your EPiServer 7 MVC View wi[...]

How to generate a Episerver Page Url for a specific language

When you work with the LinkURL property in the PageData object in EPiServer, the Url will always be set to the current language. If you are working with a multi-language website, however, sometimes you need to create links to different languages dyn[...]

FindPagesWithCriteria: How to search for pages within Episerver

A common requirement in projects is to search for pages within Episerver.  One obvious example is for your websites search (When it comes to site searching you have many options like Google Site Search or EpiFind) EPiServer provides a pretty powerfu[...]

How To Check if an Episerver Page is Being Rendered in Edit Mode or Preview Mode

There are a number of situations where you may need to display information differently; when a page is being rendered in the editor, or, previewed. you may want to display different classes, or, even hide or show whole sections of code to allow conte[...]

How To Get A Page Types Id

There are a few times in Episerver when you need to know a page types Id.  In Episerver 6 you use the GetPageTypeID-method that return the Id. In Episerver 7 and upwards this has moved.  To access the code now you can use the IContentTypeRepository. [...]

Different Ways Of Casting Objects From The Episerver Api

I have talked previously about getting objects from the Episerver API here.  In today's guide, I'm going to cover the different ways you can retrieve your data back and some of the pro's and con's with each approach. The Cover All Scenario In Episerv[...]

How To Get The Current Page In Episerver 8?

In Episerver 8 we have two API's available for us to allow fetching and modifying content. These are the IContentLoader and the IContentRepository.  In today's guide, I'm going to cover how to do some basic API calls with Episerver and hopefully expl[...]

How To Get A List Of All Page Types Defined in Episerver

Episerver provides us developers with loads of useful and extendable APIs. In today's post, I'm going to quickly go over the IContentTypeRepository and how to write some code that will return all of the page types defined in your website. [...]

How To Get The Episerver App_data Folder Paths Location In Code

If you need to write an initialization module or you're writing some code to automate your continuous integration process, it's very likely you may need to get the file path where your App_data folder lives on your server.  Luckily, this is pretty ea[...]

Homepage Learn Episerver CMS Episerver Developers Guide Episerver Api Explained
Back to top