Class ContentScheduleCollection
Represents a collection of content schedules for publishing and unpublishing content.
Inheritance
Namespace: Umbraco.Cms.Core.Models
Assembly: Umbraco.Core.dll
Syntax
public class ContentScheduleCollection : IDeepCloneable
Remarks
The underlying storage is backed by a sorted list so that the schedule is always in order of date and duplicate dates per culture are not allowed.
Constructors
View SourceContentScheduleCollection()
Declaration
public ContentScheduleCollection()
Properties
View SourceFullSchedule
Returns all schedules registered
Declaration
public IReadOnlyList<ContentSchedule> FullSchedule { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<ContentSchedule> |
Methods
View SourceAdd(DateTime?, DateTime?)
Adds a new schedule for invariant content
Declaration
public bool Add(DateTime? releaseDate, DateTime? expireDate)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime? | releaseDate | |
| DateTime? | expireDate |
Returns
| Type | Description |
|---|---|
| bool |
Add(string?, DateTime?, DateTime?)
Adds a new schedule for a culture
Declaration
public bool Add(string? culture, DateTime? releaseDate, DateTime? expireDate)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | |
| DateTime? | releaseDate | |
| DateTime? | expireDate |
Returns
| Type | Description |
|---|---|
| bool | true if successfully added, false if validation fails |
Add(ContentSchedule)
Add an existing schedule
Declaration
public void Add(ContentSchedule schedule)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentSchedule | schedule |
AddOrUpdate(string, DateTime, ContentScheduleAction)
Adds or updates a schedule entry for the specified culture and action.
Declaration
public void AddOrUpdate(string culture, DateTime dateTime, ContentScheduleAction action)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture for the schedule. |
| DateTime | dateTime | The date and time for the scheduled action. |
| ContentScheduleAction | action | The action type (release or expire). |
Clear(string?, ContentScheduleAction, DateTime?)
Clear all of the scheduled change type for the culture
Declaration
public void Clear(string? culture, ContentScheduleAction action, DateTime? date = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | |
| ContentScheduleAction | action | |
| DateTime? | date | If specified, will clear all entries with dates less than or equal to the value |
Clear(ContentScheduleAction, DateTime?)
Clear all of the scheduled change type for invariant content
Declaration
public void Clear(ContentScheduleAction action, DateTime? changeDate = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentScheduleAction | action | |
| DateTime? | changeDate | If specified, will clear all entries with dates less than or equal to the value |
ClearCollectionChangedEvents()
Clears all CollectionChanged event handlers
Declaration
public void ClearCollectionChangedEvents()
CreateWithEntry(DateTime?, DateTime?)
Creates a new ContentScheduleCollection with a schedule entry for invariant content.
Declaration
public static ContentScheduleCollection CreateWithEntry(DateTime? release, DateTime? expire)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime? | release | The release date, or null if no release is scheduled. |
| DateTime? | expire | The expiration date, or null if no expiration is scheduled. |
Returns
| Type | Description |
|---|---|
| ContentScheduleCollection | A new content schedule collection with the specified entry. |
CreateWithEntry(string, DateTime?, DateTime?)
Creates a new ContentScheduleCollection with a schedule entry for a specific culture.
Declaration
public static ContentScheduleCollection CreateWithEntry(string culture, DateTime? release, DateTime? expire)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture for the schedule. |
| DateTime? | release | The release date, or null if no release is scheduled. |
| DateTime? | expire | The expiration date, or null if no expiration is scheduled. |
Returns
| Type | Description |
|---|---|
| ContentScheduleCollection | A new content schedule collection with the specified entry. |
DeepClone()
Creates a deep clone of the current object.
Declaration
public object DeepClone()
Returns
| Type | Description |
|---|---|
| object | A deep clone of the current object. |
Equals(object?)
Declaration
public override bool Equals(object? obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj |
Returns
| Type | Description |
|---|---|
| bool |
Equals(ContentScheduleCollection?)
Declaration
public bool Equals(ContentScheduleCollection? other)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentScheduleCollection | other |
Returns
| Type | Description |
|---|---|
| bool |
GetHashCode()
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int |
GetPending(ContentScheduleAction, DateTime)
Returns all pending schedules based on the date and type provided
Declaration
public IReadOnlyList<ContentSchedule> GetPending(ContentScheduleAction action, DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentScheduleAction | action | |
| DateTime | date |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<ContentSchedule> |
GetSchedule(ContentScheduleAction?)
Gets the schedule for invariant content
Declaration
public IEnumerable<ContentSchedule> GetSchedule(ContentScheduleAction? action = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentScheduleAction? | action |
Returns
| Type | Description |
|---|---|
| IEnumerable<ContentSchedule> |
GetSchedule(string?, ContentScheduleAction?)
Gets the schedule for a culture
Declaration
public IEnumerable<ContentSchedule> GetSchedule(string? culture, ContentScheduleAction? action = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | |
| ContentScheduleAction? | action |
Returns
| Type | Description |
|---|---|
| IEnumerable<ContentSchedule> |
Remove(ContentSchedule)
Remove a scheduled change
Declaration
public void Remove(ContentSchedule change)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentSchedule | change |
RemoveIfExists(string, ContentScheduleAction)
Removes a schedule entry for the specified culture and action if it exists.
Declaration
public void RemoveIfExists(string culture, ContentScheduleAction action)
Parameters
| Type | Name | Description |
|---|---|---|
| string | culture | The culture of the schedule to remove. |
| ContentScheduleAction | action | The action type (release or expire) to remove. |
Events
View SourceCollectionChanged
Declaration
public event NotifyCollectionChangedEventHandler? CollectionChanged
Event Type
| Type | Description |
|---|---|
| NotifyCollectionChangedEventHandler |