In this tutorial, you will learn how to create and access projects within Episerver. An Episerver content project can be thought of as a giant bucket where a content editor can make a batch of content changes. Projects are useful for creating marketing campaigns. A content editor can group all content changes related to a marketing campaign into a single project. The project can be previewed at the same time. The project can be scheduled to publish at a certain time. At that point, the whole campaign will go live. Before projects, it was not possible for content editors to preview a whole campaign this way. They were forced into previewing upcoming changes one page at a time.

Like everything else Episerver, projects can be accessed via an API. In today's tutorial, we will be working with the ProjectRepository API. For the curious, the ProjectRepository can be found within Episerver.Core. Strangely for Episerver ProjectRepository does not implement any type of interface. You can still use dependency injection to access ProjectRepository, just note you will be working with a concrete implementation, rather than an API like everything else.

To get a list of all projects in code you can use this snippet:

To get access to a specific project, you can use this snippet:

To get a list of active projects, you can filter projects like this:

To create and update a project you can use the originally titled 'Save()' which will save a single project, like so:

You can also save individual items within the project, using 'SaveItems()', like this:

There are two ways to delete a project via code. On a per-project basis, or, in a batch. This can be done like this:

Or

That is all there is to it. As you can see using the API is super-simple and self-explanatory. When dealing with content within the CMS then I recommend using projects as it will make your life easier. Enjoy!