Interface IContentService
Defines the ContentService, which is an easy access to operations involving IContent
Namespace:System.Dynamic.ExpandoObject
Assembly:Umbraco.Core.dll
Syntax
public interface IContentService : IContentServiceBase, IService
Methods
AssignContentPermission(IContent, Char, IEnumerable<Int32>)
Assigns a single permission to the current content item for the specified user group ids
Declaration
void AssignContentPermission(IContent entity, char permission, IEnumerable<int> groupIds)
Parameters
Type | Name | Description |
---|---|---|
IContent | entity | |
System.Char | permission | |
System.Collections.Generic.IEnumerable<System.Int32> | groupIds |
BuildXmlCache()
This builds the Xml document used for the XML cache
Declaration
XmlDocument BuildXmlCache()
Returns
Type | Description |
---|---|
System.Xml.XmlDocument |
Copy(IContent, Int32, Boolean, Boolean, Int32)
Copies an IContent object by creating a new Content object of the same type and copies all data from the current to the new copy which is returned.
Declaration
IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to copy |
System.Int32 | parentId | Id of the Content's new Parent |
System.Boolean | relateToOriginal | Boolean indicating whether the copy should be related to the original |
System.Boolean | recursive | A value indicating whether to recursively copy children. |
System.Int32 | userId | Optional Id of the User copying the Content |
Returns
Type | Description |
---|---|
IContent | The newly created IContent object |
Copy(IContent, Int32, Boolean, Int32)
Copies an IContent object by creating a new Content object of the same type and copies all data from the current to the new copy, which is returned. Recursively copies all children.
Declaration
IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to copy |
System.Int32 | parentId | Id of the Content's new Parent |
System.Boolean | relateToOriginal | Boolean indicating whether the copy should be related to the original |
System.Int32 | userId | Optional Id of the User copying the Content |
Returns
Type | Description |
---|---|
IContent | The newly created IContent object |
Count(String)
Declaration
int Count(string contentTypeAlias = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentTypeAlias |
Returns
Type | Description |
---|---|
System.Int32 |
CountChildren(Int32, String)
Declaration
int CountChildren(int parentId, string contentTypeAlias = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId | |
System.String | contentTypeAlias |
Returns
Type | Description |
---|---|
System.Int32 |
CountDescendants(Int32, String)
Declaration
int CountDescendants(int parentId, string contentTypeAlias = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId | |
System.String | contentTypeAlias |
Returns
Type | Description |
---|---|
System.Int32 |
CountPublished(String)
Declaration
int CountPublished(string contentTypeAlias = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | contentTypeAlias |
Returns
Type | Description |
---|---|
System.Int32 |
CreateContent(String, Guid, String, Int32)
Creates an IContent object using the alias of the IContentType that this Content should based on.
Declaration
IContent CreateContent(string name, Guid parentId, string contentTypeAlias, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Content object |
System.Guid | parentId | Id of Parent for the new Content |
System.String | contentTypeAlias | Alias of the IContentType |
System.Int32 | userId | Optional id of the user creating the content |
Returns
Type | Description |
---|---|
IContent | IContent |
Remarks
Note that using this method will simply return a new IContent without any identity as it has not yet been persisted. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.
CreateContent(String, Int32, String, Int32)
Creates an IContent object using the alias of the IContentType that this Content should based on.
Declaration
IContent CreateContent(string name, int parentId, string contentTypeAlias, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Content object |
System.Int32 | parentId | Id of Parent for the new Content |
System.String | contentTypeAlias | Alias of the IContentType |
System.Int32 | userId | Optional id of the user creating the content |
Returns
Type | Description |
---|---|
IContent | IContent |
Remarks
Note that using this method will simply return a new IContent without any identity as it has not yet been persisted. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.
CreateContent(String, IContent, String, Int32)
Creates an IContent object using the alias of the IContentType that this Content should based on.
Declaration
IContent CreateContent(string name, IContent parent, string contentTypeAlias, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Content object |
IContent | parent | Parent IContent object for the new Content |
System.String | contentTypeAlias | Alias of the IContentType |
System.Int32 | userId | Optional id of the user creating the content |
Returns
Type | Description |
---|---|
IContent | IContent |
Remarks
Note that using this method will simply return a new IContent without any identity as it has not yet been persisted. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.
CreateContentFromBlueprint(IContent, String, Int32)
Declaration
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | blueprint | |
System.String | name | |
System.Int32 | userId |
Returns
Type | Description |
---|---|
IContent |
CreateContentWithIdentity(String, Int32, String, Int32)
Creates and saves an IContent object using the alias of the IContentType that this Content should based on.
Declaration
IContent CreateContentWithIdentity(string name, int parentId, string contentTypeAlias, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Content object |
System.Int32 | parentId | Id of Parent for the new Content |
System.String | contentTypeAlias | Alias of the IContentType |
System.Int32 | userId | Optional id of the user creating the content |
Returns
Type | Description |
---|---|
IContent | IContent |
Remarks
This method returns an IContent object that has been persisted to the database and therefor has an identity.
CreateContentWithIdentity(String, IContent, String, Int32)
Creates and saves an IContent object using the alias of the IContentType that this Content should based on.
Declaration
IContent CreateContentWithIdentity(string name, IContent parent, string contentTypeAlias, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the Content object |
IContent | parent | Parent IContent object for the new Content |
System.String | contentTypeAlias | Alias of the IContentType |
System.Int32 | userId | Optional id of the user creating the content |
Returns
Type | Description |
---|---|
IContent | IContent |
Remarks
This method returns an IContent object that has been persisted to the database and therefor has an identity.
Delete(IContent, Int32)
Permanently deletes an IContent object.
Declaration
void Delete(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to delete |
System.Int32 | userId | Optional Id of the User deleting the Content |
Remarks
This method will also delete associated media files, child content and possibly associated domains.
DeleteBlueprint(IContent, Int32)
Declaration
void DeleteBlueprint(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Int32 | userId |
DeleteBlueprintsOfType(Int32, Int32)
Declaration
void DeleteBlueprintsOfType(int contentTypeId, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentTypeId | |
System.Int32 | userId |
DeleteBlueprintsOfTypes(IEnumerable<Int32>, Int32)
Declaration
void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | contentTypeIds | |
System.Int32 | userId |
DeleteContentOfType(Int32, Int32)
Deletes all content of specified type. All children of deleted content is moved to Recycle Bin.
Declaration
void DeleteContentOfType(int contentTypeId, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | contentTypeId | Id of the IContentType |
System.Int32 | userId | Optional Id of the user issueing the delete operation |
Remarks
This needs extra care and attention as its potentially a dangerous and extensive operation
DeleteContentOfTypes(IEnumerable<Int32>, Int32)
Deletes all content of the specified types. All Descendants of deleted content that is not of these types is moved to Recycle Bin.
Declaration
void DeleteContentOfTypes(IEnumerable<int> contentTypeIds, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | contentTypeIds | Ids of the IContentTypes |
System.Int32 | userId | Optional Id of the user issueing the delete operation |
Remarks
This needs extra care and attention as its potentially a dangerous and extensive operation
DeleteVersion(Int32, Guid, Boolean, Int32)
Permanently deletes a specific version from an IContent object.
Declaration
void DeleteVersion(int id, Guid versionId, bool deletePriorVersions, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent object to delete a version from |
System.Guid | versionId | Id of the version to delete |
System.Boolean | deletePriorVersions | Boolean indicating whether to delete versions prior to the versionId |
System.Int32 | userId | Optional Id of the User deleting versions of a Content object |
DeleteVersions(Int32, DateTime, Int32)
Permanently deletes versions from an IContent object prior to a specific date.
Declaration
void DeleteVersions(int id, DateTime versionDate, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent object to delete versions from |
System.DateTime | versionDate | Latest version date |
System.Int32 | userId | Optional Id of the User deleting versions of a Content object |
EmptyRecycleBin()
Empties the Recycle Bin by deleting all IContent that resides in the bin
Declaration
void EmptyRecycleBin()
GetAncestors(Int32)
Gets a collection of IContent objects, which are ancestors of the current content.
Declaration
IEnumerable<IContent> GetAncestors(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent to retrieve ancestors for |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetAncestors(IContent)
Gets a collection of IContent objects, which are ancestors of the current content.
Declaration
IEnumerable<IContent> GetAncestors(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | IContent to retrieve ancestors for |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetBlueprintById(Guid)
Declaration
IContent GetBlueprintById(Guid id)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | id |
Returns
Type | Description |
---|---|
IContent |
GetBlueprintById(Int32)
Declaration
IContent GetBlueprintById(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
IContent |
GetBlueprintsForContentTypes(Int32[])
Declaration
IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] documentTypeIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | documentTypeIds |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> |
GetById(Guid)
Gets an IContent object by its 'UniqueId'
Declaration
IContent GetById(Guid key)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | key | Guid key of the Content to retrieve |
Returns
Type | Description |
---|---|
IContent | IContent |
GetById(Int32)
Gets an IContent object by Id
Declaration
IContent GetById(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Content to retrieve |
Returns
Type | Description |
---|---|
IContent | IContent |
GetByIds(IEnumerable<Guid>)
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<Guid> ids)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Guid> | ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> |
GetByIds(IEnumerable<Int32>)
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<int> ids)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.Int32> | ids |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> |
GetByLevel(Int32)
Gets a collection of IContent objects by Level
Declaration
IEnumerable<IContent> GetByLevel(int level)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | level | The level to retrieve Content from |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetByVersion(Guid)
Gets a specific version of an IContent item.
Declaration
IContent GetByVersion(Guid versionId)
Parameters
Type | Name | Description |
---|---|---|
System.Guid | versionId | Id of the version to retrieve |
Returns
Type | Description |
---|---|
IContent | An IContent item |
GetChildren(Int32)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetChildren(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Children from |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetChildrenByName(Int32, String)
Gets a collection of IContent objects by its name or partial name
Declaration
IEnumerable<IContent> GetChildrenByName(int parentId, string name)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | parentId | Id of the Parent to retrieve Children from |
System.String | name | Full or partial name of the children |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetContentForExpiration()
Gets a collection of IContent objects, which has an expiration date greater then today
Declaration
IEnumerable<IContent> GetContentForExpiration()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetContentForRelease()
Gets a collection of IContent objects, which has a release date greater then today
Declaration
IEnumerable<IContent> GetContentForRelease()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetContentInRecycleBin()
Gets a collection of an IContent objects, which resides in the Recycle Bin
Declaration
IEnumerable<IContent> GetContentInRecycleBin()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetContentOfContentType(Int32)
Gets a collection of IContent objects by the Id of the IContentType
Declaration
IEnumerable<IContent> GetContentOfContentType(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContentType |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetDescendants(Int32)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetDescendants(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Descendants from |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetDescendants(IContent)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetDescendants(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | IContent item to retrieve Descendants from |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetPagedChildren(Int32, Int32, Int32, out Int32, String, Direction, String)
Declaration
[Obsolete("Use the overload with 'long' parameter types instead")]
IEnumerable<IContent> GetPagedChildren(int id, int pageIndex, int pageSize, out int totalRecords, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
System.Int32 | pageIndex | |
System.Int32 | pageSize | |
System.Int32 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> |
GetPagedChildren(Int32, Int64, Int32, out Int64, String, Direction, Boolean, String)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, bool orderBySystemField, string filter)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Children from |
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records query would return without paging |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.Boolean | orderBySystemField | Flag to indicate when ordering by system field |
System.String | filter | Search text filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetPagedChildren(Int32, Int64, Int32, out Int64, String, Direction, String)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords, string orderBy = "SortOrder", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Children from |
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records query would return without paging |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.String | filter | Search text filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetPagedDescendants(Int32, Int32, Int32, out Int32, String, Direction, String)
Declaration
[Obsolete("Use the overload with 'long' parameter types instead")]
IEnumerable<IContent> GetPagedDescendants(int id, int pageIndex, int pageSize, out int totalRecords, string orderBy = "path", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
System.Int32 | pageIndex | |
System.Int32 | pageSize | |
System.Int32 | totalRecords | |
System.String | orderBy | |
Direction | orderDirection | |
System.String | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> |
GetPagedDescendants(Int32, Int64, Int32, out Int64, String, Direction, Boolean, String)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, bool orderBySystemField, string filter)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Descendants from |
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records query would return without paging |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.Boolean | orderBySystemField | Flag to indicate when ordering by system field |
System.String | filter | Search text filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetPagedDescendants(Int32, Int64, Int32, out Int64, String, Direction, Boolean, IQuery<IContent>)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords, string orderBy, Direction orderDirection, bool orderBySystemField, IQuery<IContent> filter)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Descendants from |
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records query would return without paging |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.Boolean | orderBySystemField | Flag to indicate when ordering by system field |
IQuery<IContent> | filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetPagedDescendants(Int32, Int64, Int32, out Int64, String, Direction, String)
Gets a collection of IContent objects by Parent Id
Declaration
IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords, string orderBy = "path", Direction orderDirection = Direction.Ascending, string filter = "")
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the Parent to retrieve Descendants from |
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records query would return without paging |
System.String | orderBy | Field to order by |
Direction | orderDirection | Direction to order by |
System.String | filter | Search text filter |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetPagedXmlEntries(String, Int64, Int32, out Int64)
Gets all XML entries found in the cmsContentXml table based on the given path
Declaration
IEnumerable<XElement> GetPagedXmlEntries(string path, long pageIndex, int pageSize, out long totalRecords)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | Path starts with |
System.Int64 | pageIndex | Page number |
System.Int32 | pageSize | Page size |
System.Int64 | totalRecords | Total records the query would return without paging |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> | A paged enumerable of XML entries of content items |
Remarks
If -1 is passed, then this will return all content xml entries, otherwise will return all descendents from the path
GetParent(Int32)
Gets the parent of the current content as an IContent item.
Declaration
IContent GetParent(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent to retrieve the parent from |
Returns
Type | Description |
---|---|
IContent | Parent IContent object |
GetParent(IContent)
Gets the parent of the current content as an IContent item.
Declaration
IContent GetParent(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | IContent to retrieve the parent from |
Returns
Type | Description |
---|---|
IContent | Parent IContent object |
GetPermissionsForEntity(IContent)
Returns implicit/inherited permissions assigned to the content item for all user groups
Declaration
EntityPermissionCollection GetPermissionsForEntity(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content |
Returns
Type | Description |
---|---|
EntityPermissionCollection |
GetPublishedVersion(Int32)
Gets the published version of an IContent item
Declaration
IContent GetPublishedVersion(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent to retrieve version from |
Returns
Type | Description |
---|---|
IContent | An IContent item |
GetPublishedVersion(IContent)
Gets the published version of a IContent item.
Declaration
IContent GetPublishedVersion(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The content item. |
Returns
Type | Description |
---|---|
IContent | The published version, if any; otherwise, null. |
GetRootContent()
Gets a collection of IContent objects, which reside at the first level / root
Declaration
IEnumerable<IContent> GetRootContent()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
GetVersionIds(Int32, Int32)
Gets a list of all version Ids for the given content item ordered so latest is first
Declaration
IEnumerable<Guid> GetVersionIds(int id, int maxRows)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | |
System.Int32 | maxRows | The maximum number of rows to return |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Guid> |
GetVersions(Int32)
Gets a collection of an IContent objects versions by its Id
Declaration
IEnumerable<IContent> GetVersions(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<IContent> | An Enumerable list of IContent objects |
HasChildren(Int32)
Checks whether an IContent item has any children
Declaration
bool HasChildren(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent |
Returns
Type | Description |
---|---|
System.Boolean | True if the content has any children otherwise False |
HasPublishedVersion(Int32)
Checks whether an IContent item has any published versions
Declaration
bool HasPublishedVersion(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContent |
Returns
Type | Description |
---|---|
System.Boolean | True if the content has any published version otherwise False |
IsPublishable(IContent)
Checks if the passed in IContent can be published based on the anscestors publish state.
Declaration
bool IsPublishable(IContent content)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | IContent to check if anscestors are published |
Returns
Type | Description |
---|---|
System.Boolean | True if the Content can be published, otherwise False |
Move(IContent, Int32, Int32)
Moves an IContent object to a new location
Declaration
void Move(IContent content, int parentId, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to move |
System.Int32 | parentId | Id of the Content's new Parent |
System.Int32 | userId | Optional Id of the User moving the Content |
MoveToRecycleBin(IContent, Int32)
Deletes an IContent object by moving it to the Recycle Bin
Declaration
void MoveToRecycleBin(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to delete |
System.Int32 | userId | Optional Id of the User deleting the Content |
Remarks
Move an item to the Recycle Bin will result in the item being unpublished
Publish(IContent, Int32)
Publishes a single IContent object
Declaration
bool Publish(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to publish |
System.Int32 | userId | Optional Id of the User issueing the publishing |
Returns
Type | Description |
---|---|
System.Boolean | True if publishing succeeded, otherwise False |
PublishWithChildren(IContent, Int32)
Publishes a IContent object and all its children
Declaration
[Obsolete("Use PublishWithChildrenWithStatus instead, that method will provide more detailed information on the outcome and also allows the includeUnpublished flag")]
bool PublishWithChildren(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to publish along with its children |
System.Int32 | userId | Optional Id of the User issueing the publishing |
Returns
Type | Description |
---|---|
System.Boolean | True if publishing succeeded, otherwise False |
PublishWithChildrenWithStatus(IContent, Int32, Boolean)
Publishes a IContent object and all its children
Declaration
IEnumerable<Attempt<PublishStatus>> PublishWithChildrenWithStatus(IContent content, int userId = 0, bool includeUnpublished = false)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to publish along with its children |
System.Int32 | userId | Optional Id of the User issueing the publishing |
System.Boolean | includeUnpublished |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Attempt<PublishStatus>> | The list of statuses for all published items |
PublishWithStatus(IContent, Int32)
Publishes a single IContent object
Declaration
Attempt<PublishStatus> PublishWithStatus(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to publish |
System.Int32 | userId | Optional Id of the User issueing the publishing |
Returns
Type | Description |
---|---|
Attempt<PublishStatus> | The published status attempt |
RebuildXmlStructures(Int32[])
Rebuilds all xml content in the cmsContentXml table for all documents
Declaration
void RebuildXmlStructures(params int[] contentTypeIds)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | contentTypeIds | Only rebuild the xml structures for the content type ids passed in, if none then rebuilds the structures for all content |
ReplaceContentPermissions(EntityPermissionSet)
Declaration
void ReplaceContentPermissions(EntityPermissionSet permissionSet)
Parameters
Type | Name | Description |
---|---|---|
EntityPermissionSet | permissionSet |
RePublishAll(Int32)
Re-Publishes all Content
Declaration
bool RePublishAll(int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | userId | Optional Id of the User issueing the publishing |
Returns
Type | Description |
---|---|
System.Boolean | True if publishing succeeded, otherwise False |
Rollback(Int32, Guid, Int32)
Rollback an IContent object to a previous version. This will create a new version, which is a copy of all the old data.
Declaration
IContent Rollback(int id, Guid versionId, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id | Id of the IContentbeing rolled back |
System.Guid | versionId | Id of the version to rollback to |
System.Int32 | userId | Optional Id of the User issueing the rollback of the Content |
Returns
Type | Description |
---|---|
IContent | The newly created IContent object |
Save(IEnumerable<IContent>, Int32, Boolean)
Saves a collection of IContent objects.
Declaration
void Save(IEnumerable<IContent> contents, int userId = 0, bool raiseEvents = true)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IContent> | contents | Collection of IContent to save |
System.Int32 | userId | Optional Id of the User saving the Content |
System.Boolean | raiseEvents | Optional boolean indicating whether or not to raise events. |
Save(IContent, Int32, Boolean)
Saves a single IContent object
Declaration
void Save(IContent content, int userId = 0, bool raiseEvents = true)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to save |
System.Int32 | userId | Optional Id of the User saving the Content |
System.Boolean | raiseEvents | Optional boolean indicating whether or not to raise events. |
SaveAndPublish(IContent, Int32, Boolean)
Saves and Publishes a single IContent object
Declaration
[Obsolete("Use SaveAndPublishWithStatus instead, that method will provide more detailed information on the outcome")]
bool SaveAndPublish(IContent content, int userId = 0, bool raiseEvents = true)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to save and publish |
System.Int32 | userId | Optional Id of the User issueing the publishing |
System.Boolean | raiseEvents | Optional boolean indicating whether or not to raise save events. |
Returns
Type | Description |
---|---|
System.Boolean | True if publishing succeeded, otherwise False |
SaveAndPublishWithStatus(IContent, Int32, Boolean)
Saves and Publishes a single IContent object
Declaration
Attempt<PublishStatus> SaveAndPublishWithStatus(IContent content, int userId = 0, bool raiseEvents = true)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to save and publish |
System.Int32 | userId | Optional Id of the User issueing the publishing |
System.Boolean | raiseEvents | Optional boolean indicating whether or not to raise save events. |
Returns
Type | Description |
---|---|
Attempt<PublishStatus> | True if publishing succeeded, otherwise False |
SaveBlueprint(IContent, Int32)
Declaration
void SaveBlueprint(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Int32 | userId |
SendToPublication(IContent, Int32)
Declaration
bool SendToPublication(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Int32 | userId |
Returns
Type | Description |
---|---|
System.Boolean |
Sort(IEnumerable<IContent>, Int32, Boolean)
Sorts a collection of IContent objects by updating the SortOrder according to the ordering of items in the passed in System.Collections.Generic.IEnumerable<T>.
Declaration
bool Sort(IEnumerable<IContent> items, int userId = 0, bool raiseEvents = true)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<IContent> | items | |
System.Int32 | userId | |
System.Boolean | raiseEvents |
Returns
Type | Description |
---|---|
System.Boolean | True if sorting succeeded, otherwise False |
Remarks
Using this method will ensure that the Published-state is maintained upon sorting so the cache is updated accordingly - as needed.
Sort(Int32[], Int32, Boolean)
Sorts a collection of IContent objects by updating the SortOrder according to the ordering of node Ids passed in.
Declaration
bool Sort(int[] ids, int userId = 0, bool raiseEvents = true)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | ids | |
System.Int32 | userId | |
System.Boolean | raiseEvents |
Returns
Type | Description |
---|---|
System.Boolean | True if sorting succeeded, otherwise False |
Remarks
Using this method will ensure that the Published-state is maintained upon sorting so the cache is updated accordingly - as needed.
UnPublish(IContent, Int32)
UnPublishes a single IContent object
Declaration
bool UnPublish(IContent content, int userId = 0)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | The IContent to publish |
System.Int32 | userId | Optional Id of the User issueing the publishing |
Returns
Type | Description |
---|---|
System.Boolean | True if unpublishing succeeded, otherwise False |