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.

1

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 Epise[...]

2

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<[...]

3

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 [...]

4

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.Curren[...]

5

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 power[...]

6

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'[...]

7

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[...]

8

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[...]

9

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[...]

10

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. [...]

11

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[...]

12

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. [...]

13

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.Co[...]

14

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[...]

15

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 pa[...]

16

How To Get The Url For An Image In Episerver

When you create new sites, allowing content editors to add images to your site is kind of like building websites 101. Adding images in Episerver is, handily, equally as easy, and you can get up and running very quickly. Defining A Property The firs[...]

Back to top