Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The Content class represents a single item in the content tree, its values are fetched directly from the database, not from the cache.
The Content
class represents a single item in the content tree, its values are fetched directly from the database, not from the cache. Notice the Content class should strictly be used for CRUD operations, not complex queries, as it is not flexible nor fast enough for this.
All content is versioned, so on each individual change, a new version is stored. Past versions can only be retrieved from the Content
api, not from the cache.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statements:
Constructor for creating a new Content object where the necessary parameters are the name of the Content, the parent of the Content as an IContent
object and the ContentType as an IContentType
object for the Content being created. In addition, there is an optional parameter for the culture.
Constructor for creating a new Content object where the necessary parameters are the name of the Content, the parent of the Content as an IContent
object, the ContentType as an IContentType
object for the Content being created and the id of the user as a int
. In addition, there is an optional parameter for the culture.
Constructor for creating a new Content object where the necessary parameters are the name of the Content, the parent of the Content as an IContent
object, the ContentType as an IContentType
object and a PropertyCollection
for the Content being created. In addition, there is an optional parameter for the culture.
Constructor for creating a new Content object where the necessary parameters are the name of the Content, the id of the parent as int
and the ContentType as an IContentType
object for the Content being created. In addition, there is an optional parameter for the culture.
Constructor for creating a new Content object where the necessary parameters are the name of the Content, the parent id of the Content as an int
object, the ContentType as an IContentType
object for the Content being created and the id of the user as a int
. In addition, there is an optional parameter for the culture.
Constructor for creating a new Content object where the necessary parameters are the name of the Content, the id of the parent as int
, the ContentType as an IContentType
object and a PropertyCollection
for the Content being created.In addition, there is an optional parameter for the culture.
Gets or Sets a DateTime
object, indicating then the given Content was created.
Gets or Sets the Id of the User
who created the Content.
Returns a ISimpleContentType
object representing the DocumentType used by the given Content
.
Returns the id as an int
of the ContentType
object representing the DocumentType used by the given Content
.
Returns the unique Content
Id as a Int
, this ID is based on a Database identity field, and is therefore not safe to reference in code which are moved between different instances, use Key instead.
Returns the Guid
assigned to the Content during creation. This value is unique, and should never change, even if the content is moved between instances.
Gets Languages of the Content as a IEnumerable<string>
.
Gets or Sets the given Content
level in the site hierarchy as an Int
. Content placed at the root of the site, will return 1, content right underneath will return 2, and so on.
Gets or Sets the name of the content as a String
.
Gets or Sets the parent Content
Id as an Int
.
Gets or Sets the path of the content as a String
. This string contains a comma separated list of the ancestor Ids including the current contents own id at the end of the string.
Gets or Sets the IPropertyCollection
object, which is a collection of IProperty
objects. Each property corresponds to a PropertyType
, which is defined on the ContentType
.
Returns a Bool
indicating whether the given Content
is published and available on the website or not. Notice: the published flag does not check the current in-memory cache, so this flag is not a guarantee that the Content is/is not available in the cache and the frontend of the website.
If set, returns DateTime?
indicating when the Content
should be published and made available on the website and cache.
Returns the given Content
index, compared to sibling content.
Returns a IPublishedState
enum with the status of the Content being either Unpublished, Published, Publishing, Unpublishing.
Gets or sets the template id used to render the content.
Returns a Bool
indicating whether the given Content
is currently in the recycle bin.
Gets or Sets a DateTime
object, indicating when the given Content was last updated.
Returns the current Version Id as a int
, for each change made to a content item, its values are stored under a new Version. This version is identified by a int
.
Gets or Sets the Id of the User
who made the latest edit on the Content.
Gets the IProfile
object for the Creator of this Content, which contains the Id and Name of the User who created this Content item.
Gets the value of a Property as an Object
.
Gets the value of a Property as the defined type 'TPassType'.
Gets the IProfile
object for the Writer of this Content, which contains the Id and Name of the User who last updated this Content item.
Returns a Bool
indicating whether the Content object has a property with the supplied alias.
Sets the value of a property by its alias.
Returns an XElement
containing the Content data, based off the latest changes. Is used when the published content is sent to the in-memory xml cache.
Represents a Dictionary Item. A Dictionary Item is what you see in the Translation / Dictionary tree.
Represents a Dictionary Item. A Dictionary Item is what you see in the Translation / Dictionary tree.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statement:
Constructor for creating a new DictionaryItem
object where the necessary parameter is the key of the DictionaryItem
as a string
.
Constructor for creating a new DictionaryItem
object where the necessary parameters are the parentKey as Guid
and the key of the DictionaryItem
as a string
. Use this one if you want to create a DictionaryItem
underneath another one.
Gets or sets the Key for the Dictionary Item.
Gets or Sets a Guid?
of the Dictionary Item ParentId.
Gets or sets a IEnumerable<IDictionaryTranslation>
of translations for the Dictionary Item.
A DataType is what you see in the backoffice in the Settings / DataTypes tree. The listed nodes are definitions of the DataTypes that are available to use on your PropertyTypes.
A DataType is what you see in the backoffice in the Settings / DataTypes tree. The listed nodes are definitions of the DataTypes that are available to use on your PropertyTypes.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statement:
Constructor for creating a new DataType
object where the necessary parameters are a IDataEditor
and a IConfigurationEditorJsonSerializer
. Optionally, the parentId can be added, if not provided the default value is -1, which means it will be created at root level.
Gets or Sets a DateTime
object, indicating then the given DataType was created.
Gets or Sets the Id of the User
who created the DataType.
Gets or Sets the DatabaseType as a ValueStorageType
enum for which the DataType's value is saved as.
Returns the unique DataType
ID as an Int
. The ID, derived from a database identity field, isn't safe for code references as they are moved across instances. Therefore it's recommended to use Key
instead.
Returns the Guid
assigned to the DataType during creation. This value is unique, and should never change, even if the DataType is moved between instances.
Gets or Sets the given DataType
level in the site hierarchy as an Int
. DataType placed at the root of the site, will return 1, DataType right underneath will return 2, and so on.
Gets or Sets the name of the DataType
as a String
.
Gets or Sets the parent DataType
Id as an Int
.
Gets or Sets the path of the DataType
as a String
. This string contains a comma separated list of the ancestor Ids including the current contents own id at the end of the string.
Returns the given DataType
index, compared to sibling DataType.
Returns a Bool
indicating whether the given DataType
is currently in the recycle bin.
The Media class represents a single item in the media tree.
The Media
class represents a single item in the media tree, its values are fetched directly from the database, not from the cache. Notice the Media class should strictly be used for CRUD operations. Media is already stored in cache, so for querying Media you'd want to use the IUmbracoContext.IPublishedMediaCache
to get the media. Then one would use LINQ to query and filter the collection.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statements:
Constructor for creating a new Media object where the necessary parameters are the name of the Media, the parent of the Media as an IMedia
object and the MediaType as an IMediaType
object for the Media being created.
Constructor for creating a new Media object where the necessary parameters are the name of the Media, the parent of the Media as an IMedia
object, the MediaType as an IMediaType
object and a IPropertyCollection
for the Media being created.
Constructor for creating a new Media object where the necessary parameters are the name of the Media, the id of the parent as int
and the MediaType as an IMediaType
object for the Media being created.
Constructor for creating a new Media object where the necessary parameters are the name of the Media, the id of the parent as int
, the MediaType as an IMediaType
object and a IPropertyCollection
for the Media being created.
Gets or Sets a DateTime
object, indicating then the given Media was created.
Gets or Sets the Id of the User
as an int
who created the Media.
Returns a ISimpleContentType
object representing the ContentType used by the given Media
.
Returns the id as an int
of the MediaType
object representing the ContentType used by the given Media
.
Returns the unique Media
Id as a Int
, this ID is based on a Database identity field, and is therefore not safe to reference in code which are moved between different instances, use Key instead.
Returns the Guid
assigned to the Media during creation. This value is unique, and should never change, even if the Media is moved between instances.
Gets or Sets the given Media
level in the site hierarchy as an Int
. Media placed at the root of the tree, will return 1, Media right underneath will return 2, and so on.
Gets or Sets the name of the Media as a String
.
Gets or Sets the parent Media
Id as an Int
.
Gets or Sets the path of the Media as a String
. This string contains a comma separated list of the ancestors Ids including the current medias own id at the end of the string.
Gets or Sets the PropertyCollection
object, which is a collection of Property
objects. Each property corresponds to a PropertyType
, which is defined on the MediaType
.
Returns the given Media
index, compared to sibling media.
Returns a Bool
indicating whether the given Media
is currently in the recycle bin.
Gets or Sets a DateTime
object, indicating when the given Media was last updated.
Returns the current Version Id as a Guid
, For each change made to a Media item, its values are stored under a new Version. This version is identified by a Guid
.
Changes the IMediaType
for the current Media object and removes PropertyTypes and Properties, which are not part of the new MediaType
. Please use with caution as this remove differences between the new and old MediaType.
Gets the IProfile
object for the Creator of this Media, which contains the Id and Name of the User who created this Media item.
Gets the value of a Property as an Object
.
Gets the value of a Property as the defined type 'TPassType'.
Returns a Bool
indicating whether the Media object has a property with the supplied alias.
Sets the value of a property by its alias.
It is worth noting that it is also possible to pass a HttpPostedFile, HttpPostedFileBase or HttpPostedFileWrapper to the SetValue method, so it can be used for uploads.
Returns an XElement
containing the Media data, based off the latest changes. When the Media item is saved the xml is stored in the database.
Represents a Template file.
Represents a Template file.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statements:
Constructor for creating a new Template object. The necessary parameters include a short String Helper as an IShortStringHelper
. The name and alias of the Template must be provided as string
values.
Gets the Alias of the File, which is the name without the extension.
Returns true if the template is used as a layout for other templates (that is, it has 'children')
Returns the alias of the master template if one is set.
Returns the id of the master template if one is set.
Gets the Name of the File including extension.
Sets the master template of the template.
Represents a Relation between two items.
Represents a Relation between two items.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statement:
Constructor for creating a new Relation object. The necessary parameters are the Id of the parent item as an int
, the Id of the child as an int
and the relationType as IRelationType
.
A second constructor exists but it should not be used because it is used to reconstruct a relation from the data source.
Gets or sets the Child Id of the Relation (Destination)
Gets or sets a comment for the Relation
Gets or sets the Parent Id of the Relation (Source)
Gets or sets the RelationType for the Relation
Gets the Id of the RelationType that this Relation is based on.
Represents a Language. Installed languages can be found in the settings section.
Represents a Language. Installed languages can be found in the settings section.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statement:
Constructor for creating a new Language
object where the necessary parameter are the global settings as GlobalSettings
and the isoCode as a string
.
To create a new Language the global setting parameter is necessary. You can find more info about how to use configuration in code in the .
Gets the CultureInfo object for the language.
Gets or sets the culture name of the language.
Gets or sets the identifier of a fallback language. The fallback language can be used in multi-lingual scenarios, to help define fallback strategies when a value does not exist for a requested language.
Gets or sets a value indicating whether the language is the default language.
Gets or sets a value indicating whether the language is mandatory. When a language is mandatory, a multi-lingual document cannot be published without that language being published, and unpublishing that language unpublishes the entire document.
Gets or sets the ISO code of the language.
The `RelationType` class represents a relation definition between two node types (content or media).
The RelationType
class represents a relation definition between two node types (content or media). For example keeping track of node usage across the site, in order to avoid deleting content that is used else where. When querying a relation, it is typically done using the parent node key. However, if the RelationType
is bidirectional, querying with the child node key is also possible.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statement:
Create a new RelationType object with this constructor. It requires a string
alias, the relation type's name, and a bool
for bidirectionality. Additionally, specify the Guid?
keys for both child and parent object types involved in the relation.
Gets or sets the Name of the RelationType as a String
.
Gets or sets the Alias of the RelationType as String
.
Gets or sets a boolean
indicating whether the RelationType is Bidirectional (true) or Parent to Child (false)
Gets or sets the Parents object type key as Guid?
Gets or sets the Childs object type key as Guid?
Represents a registered server in a multiple-servers environment.
The ServerRegistration
class represents a registered server in a multiple-servers environment.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statement:
Constructor for creating a new ServerRegistration object. The necessary parameters are the serverAddress as a string
, the serverIdentity as a string
and the date and time of registration as a DateTime
A second constructor exists but it should not be used because it is used to reconstruct a ServerRegistration
from the data source.
Gets the date and time the registration was last accessed.
Gets or sets a value indicating whether the server is active.
Gets or sets a value indicating whether the server has the SchedulingPublisher role
Gets the date and time the registration was created.
Gets or sets the server URL.
Gets or sets the server unique identity.
A MediaType is almost the same as a ContentType. I.e. a model / data definition for your media nodes.
A MediaType is almost the same as a , that is, a model / data definition for your media nodes
You can set icon, thumbnail and description. It is also possible to add groups and properties.
A Media Type differs from a Document Type in that it has no templates.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statements:
Constructor for creating a new MediaType
object where the necessary parameters are a short string helper IShortStringHelper
and the Id of the parent MediaType
as an Int
.
Constructor for creating a new MediaType
object where the necessary parameter are a short string helper IShortStringHelper
and the parent MediaType
as an IMediaType
object.
This constructor creates a new MediaType
object and requires the following parameters: a short string helper IShortStringHelper
and the parent MediaType
as an IMediaType
object. Additionally, the alias of the MediaType
should be provided as a string
.
Gets or Sets the Alias as a String
of the MediaType.
Gets or Sets an Enumerable
list of ContentTypeSort
objects of the MediaTypes allowed under the current MediaType.
The ContentTypeSort
is an object with a lazy Id, int SortOrder and string Alias used to sort the MediaTypes within the list of AllowedContentTypes.
Gets a list of MediaTypes
as IContentTypeComposition
objects that make up a composition of PropertyGroups and PropertyTypes for the current MediaType.
The ContentTypeComposition
provides a mixin-type functionality in that you can compose a MediaType of one or more other MediaTypes in a complex structure. But please keep in mind that the backoffice does not fully support these complex structures yet
Gets a list of all PropertyGroup
objects from the composition including PropertyGroups from the current MediaType.
Gets a list of all PropertyType
objects from the composition including PropertyTypes from the current MediaType.
Gets or Sets a DateTime
object, indicating then the given MediaType was created.
Gets or Sets the Id of the User
who created the MediaType.
Gets or Sets the Description as a String
for the MediaType.
Gets or Sets the Icon as a String
for the MediaType.
Retrieves the unique MediaType
ID as an Int
. This ID is based on a Database identity field and is therefore not safe to reference in code when moved between different instances.
Gets the Guid
assigned to the MediaType during creation. This value is unique, and should never change, even if the content is moved between instances.
Gets or Sets the given MediaType
level in the site hierarchy as an Int
. MediaTypes placed at the root of the tree, will return 1, content right underneath will return 2, and so on.
Gets or Sets the name of the MediaType as a String
.
Gets or Sets the parent MediaType
Id as an Int
.
Gets or Sets the path of the MediaType as a String
. This string contains a comma separated list of the ancestor Ids including the current MediaTypes own id at the end of the string.
Gets or Sets a PropertyGroupCollection
containing a list of PropertyGroups for the current MediaType.
Gets an Enumerable
list of PropertyTypes aggregated for all groups within the current MediaType, as well as PropertyTypes not within a group.
Gets the given MediaType
index, compared to sibling content.
Gets or Sets the Thumbnail as a String
for the MediaType.
Adds a new MediaType
to the list of composite MediaTypes.
Returns an Enumerable
list of MediaType aliases as String
from the current composition.
Returns an Enumerable
list of MediaType Ids as Int
from the current composition.
Checks if a MediaType
with the supplied alias exists in the list of composite MediaTypes.
Removes a MediaType
with the supplied alias from the list of composite MediaTypes.
Removes a PropertyType
from the current MediaType
.
A ContentType corresponds to the Document Type found in the backoffice.
A ContentType corresponds to the Document Type found in the backoffice. The ContentType is a model / data definition for your content nodes. Every content node on an Umbraco web site always maps to a backing Document Type.
A Document Type is composed by Properties, which are grouped by Tabs (or PropertyGroups in the API). It can also inherit properties and tabs from other Document Types.
It is possible to link one or more Templates to a Document Type. This determines how your model/data is rendered to the user.
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
All samples in this document will require references to the following dll:
Umbraco.Core.dll
All samples in this document will require the following using statements:
Constructor for creating a new ContentType
object. The necessary parameters are a short string helper IShortStringHelper
, the parent ContentType
as an IContentType
and the alias of the new ContentType
as string
.
Constructor for creating a new ContentType
object where the necessary parameters are a short string helper IShortStringHelper
and the Id of the parent ContentType
as an Int
.
Gets or Sets the Alias as a String
of the ContentType.
Gets or Sets a Bool
indicating whether this ContentType is allowed at the root. If one or more ContentTypes are set to 'AllowedAsRoot' only they are shown in the create dialog at the root level in the backoffice.
Gets or Sets an Enumerable
list of ContentTypeSort
objects of the ContentTypes allowed under the current ContentType.
The ContentTypeSort
is an object with a lazy Id, int SortOrder and string Alias used to sort the MediaTypes within the list of AllowedContentTypes.
Gets or Sets an Enumerable
list of ITemplates
which are allowed for the current ContentType.
Gets a list of ContentTypes
as IContentTypeComposition
objects that make up a composition of PropertyGroups and PropertyTypes for the current ContentType.
The ContentTypeComposition provides a mixin-type functionality in that you can compose a ContentType of one or more other ContentTypes in a complex structure. But please be aware that the backoffice does not fully support these complex structures yet.
Gets a list of all 'PropertyGroup` objects from the composition including PropertyGroups from the current ContentType.
Gets a list of all PropertyType
objects from the composition including PropertyTypes from the current ContentType.
Gets or Sets a DateTime
object, indicating then the given ContentType was created.
Gets or Sets the Id of the User
who created the ContentType.
Gets or Sets the Description as a String
for the ContentType.
Gets the default Template set as an ITemplate
object for this ContentType.
Gets or Sets the Icon as a String
for the ContentType.
Gets the unique ContentType
Id as an Int
. The ID, derived from a database identity field, isn't safe for code references as they are moved across instances. Therefore it's recommended to use Key
instead.
Gets the Guid
assigned to the ContentType during creation. This value is unique, and should never change, even if the content is moved between instances.
Gets or Sets the given ContentType
level in the site hierarchy as an Int
. ContentTypes placed at the root of the tree, will return 1, content right underneath will return 2, and so on.
Gets or Sets the name of the ContentType as a String
.
Gets or Sets the parent ContentType
Id as an Int
.
Gets or Sets the path of the ContentType as a String
. This string contains a comma separated list of the ancestors Ids including the current ContentTypes own id at the end of the string.
Gets or Sets a PropertyGroupCollection
containing a list of PropertyGroups for the current ContentType.
Gets an Enumerable
list of PropertyTypes aggregated for all groups within the current ContentType, as well as PropertyTypes not within a group.
Gets the given ContentType
index, compared to sibling content.
Gets or Sets the Thumbnail as a String
for the ContentType.
Adds a new ContentType
to the list of composite ContentTypes.
Returns an Enumerable
list of ContentType aliases as String
from the current composition.
Returns an Enumerable
list of ContentType Ids as Int
from the current composition.
Checks if a ContentType
with the supplied alias exists in the list of composite ContentTypes.
Sets the default Template
for the current ContentType.
Removes a ContentType
with the supplied alias from the list of composite ContentTypes.
Removes a PropertyType
from the current ContentType
.
Removes a Template
from the list of allowed templates.