# Class ContentMgr

- [TopLevel.Object](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md)
  - [dw.content.ContentMgr](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md)

Provides helper methods for getting content assets, library folders and the
content library of the current site.

## Constant Summary

| Constant                                                                                                                                   | Description                                                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [PRIVATE_LIBRARY](#private_library): [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PrivateLibrary" | The input string to identify that the library is a private site library when invoking [getLibrary(String)](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getlibrarystring). |

## Property Summary

| Property                                                                                                                          | Description                                      |
| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------ |
| [siteLibrary](#sitelibrary): [Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md) `(read-only)` | Returns the content library of the current site. |

## Constructor Summary

This class does not have a constructor, so you cannot create it directly.

## Method Summary

| Method                                                                                                                                                                                                                                                                                                   | Description                                                                                    |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| static [getContent](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getcontentlibrary-string)([Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)) | Returns the content with the corresponding identifier within the specified library.            |
| static [getContent](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getcontentstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                 | Returns the content with the corresponding identifier within the current  site's site library. |
| static [getFolder](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getfolderlibrary-string)([Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md), [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))   | Returns the folder identified by the specified id within the specified library.                |
| static [getFolder](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getfolderstring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                   | Returns the folder identified by the specified id within the current  site's site library.     |
| static [getLibrary](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getlibrarystring)([String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md))                                                                                                 | Returns the content library specified by the given id.                                         |
| static [getSiteLibrary](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getsitelibrary)()                                                                                                                                                                                 | Returns the content library of the current site.                                               |

### Methods inherited from class Object

[assign](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#assignobject-object), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject), [create](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#createobject-object), [defineProperties](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertiesobject-object), [defineProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#definepropertyobject-object-object), [entries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#entriesobject), [freeze](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#freezeobject), [fromEntries](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#fromentriesiterable), [getOwnPropertyDescriptor](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertydescriptorobject-object), [getOwnPropertyNames](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertynamesobject), [getOwnPropertySymbols](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getownpropertysymbolsobject), [getPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#getprototypeofobject), [hasOwnProperty](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#hasownpropertystring), [is](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isobject-object), [isExtensible](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isextensibleobject), [isFrozen](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isfrozenobject), [isPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#isprototypeofobject), [isSealed](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#issealedobject), [keys](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#keysobject), [preventExtensions](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#preventextensionsobject), [propertyIsEnumerable](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#propertyisenumerablestring), [seal](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#sealobject), [setPrototypeOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#setprototypeofobject-object), [toLocaleString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tolocalestring), [toString](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#tostring), [valueOf](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valueof), [values](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.Object.md#valuesobject)

## Constant Details

### PRIVATE_LIBRARY

- PRIVATE_LIBRARY: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md) = "PrivateLibrary"
  - : The input string to identify that the library is a private site library when invoking [getLibrary(String)](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#getlibrarystring).

***

## Property Details

### siteLibrary

- siteLibrary: [Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md) `(read-only)`
  - : Returns the content library of the current site.

***

## Method Details

### getContent(Library, String)

- static getContent(library: [Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md), id: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Content](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md)
  - : Returns the content with the corresponding identifier within the specified library.

    **Parameters:**

    - library - the content library to look for the content in
    - id - the ID of the content asset to find.

    **Returns:**

    - the content if found, or null if not found.

***

### getContent(String)

- static getContent(id: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Content](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Content.md)
  - : Returns the content with the corresponding identifier within the current
    site's site library.

    **Parameters:**

    - id - the ID of the content asset to find.

    **Returns:**

    - the content if found, or null if not found.

***

### getFolder(Library, String)

- static getFolder(library: [Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md), id: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Folder](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Folder.md)
  - : Returns the folder identified by the specified id within the specified library.

    **Parameters:**

    - library - the content library to look for the folder in
    - id - the ID of the folder to find.

    **Returns:**

    - the folder, or null if not found.

***

### getFolder(String)

- static getFolder(id: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Folder](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Folder.md)
  - : Returns the folder identified by the specified id within the current
    site's site library.

    **Parameters:**

    - id - the ID of the folder to find.

    **Returns:**

    - the folder, or null if not found.

***

### getLibrary(String)

- static getLibrary(libraryId: [String](/docs/commerce/b2c-commerce/references/b2c-script-api/TopLevel.String.md)): [Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md)
  - : Returns the content library specified by the given id. If [PRIVATE_LIBRARY](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.ContentMgr.md#private_library) is used, then the current
    site's private library will be returned.

    **Parameters:**

    - libraryId - the id of the library to return.

    **Returns:**

    - the library for the passed id. Returns null if there is no content library with that id.

***

### getSiteLibrary()

- static getSiteLibrary(): [Library](/docs/commerce/b2c-commerce/references/b2c-script-api/dw.content.Library.md)
  - : Returns the content library of the current site.

    **Returns:**

    - the content library of the current site, or null if there is not
      content library assigned to the current site.

***
