---
title: "Work with items as resources"
slug: "work-with-items-as-resources"
abstract: "Describes the methods to check for overridden items and whether items are stored in the database or the resource file."
---
# Work with items as resources

Sitecore provides methods to check for overridden items and to check if an item is stored in the database or the resource file.

<details>
<summary><h2>Check if an item exists in both the database and the resource file</h2></summary>

To check if a resource item or list of items is overridden, you can use the `Database.DataManager.DataSource.GetItemLocations(itemId).IsOverridden()` method.

This method returns `true` if the item exists both in the database and in the resource file, otherwise `false`.

For example, to check if an item with `itemId` is overridden in the *Master* database:

```

var db = Database.GetDatabase(“master”);

bool isOverridden = db.DataManager.DataSource.GetItemLocations(itemId).IsOverridden();

```

For example, to check if a list of items is overridden in the *Core* database:

```

var db = Database.GetDatabase(“core”);

ICollection<AggregatedItemLocations>
locations = db.DataManager.DataSource.GetItemLocations(itemIds);

var overriddenItemIds = locations.Where(l=>l.IsOverridden());

```

</details>

<details>
<summary><h2>Check if an item exists in the database</h2></summary>

To check if an item is stored in the database, you can use the `Database.DataManager.DataSource.GetItemLocations(itemId).IsSql()` method.

For example, to check if an item exists in the *Master* database:

```

var db = Database.GetDatabase(“master”);

bool isInDatabase = db.DataManager.DataSource.GetItemLocations(itemId).IsSql();

```

</details>

<details>
<summary><h2>Check if an item exists in the resource file</h2></summary>

To check if an item is stored in the resource file, you can use the `Database.DataManager.DataSource.GetItemLocations(itemId).IsResource()` method.

For example, to check if an item exists in the *Master* resource file:

```

var db = Database.GetDatabase(“master”);

bool isResource = db.DataManager.DataSource.GetItemLocations(itemId).IsResource();

```

</details>

<details>
<summary><h2>Get a list of all items that exist in both the resource file and database</h2></summary>

To get a list of all overridden items in the database, use the `Database.DataManager.DataSource.GetOverriddenItems()` method.

For example, to get a list of all the overridden items in the *Master* database:

```

var db = Database.GetDatabase(“master”);

var overriddenItemIds = db.DataManager.DataSource.GetOverriddenItems();

```

</details>