Class SubscriptionInfo
Handles subscription for a user other than the currently logged in. Use Subscription for the currently logged on user.
Inheritance
Inherited Members
Namespace: EPiServer.Personalization
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7Syntax
public class SubscriptionInfo
Examples
Adds a subscription for a user with login "John".
IList<EPiServerProfile> list = EPiServerProfile.GetProfiles("John");
if(list.Count != 1)
throw new EPiServerException("Can't set subscriptions for groups or non existing members!");
EPiServerProfile profile = EPiServerProfile.GetProfiles("John")[0];
EPiServer.Core.PageReference currentPage = EPiServer.DataFactory.Instance.CurrentPage.PageLink;
if (profile.SubscriptionInfo.IsSubscribingTo(currentPage))
Response.Write("User is already subscribing");
else
{
profile.SubscriptionInfo.SubscribeTo(currentPage);
Response.Write("Subscription added");
}
Constructors
SubscriptionInfo()
Declaration
public SubscriptionInfo()
SubscriptionInfo(IContentRepository)
Declaration
public SubscriptionInfo(IContentRepository contentRepository)
Parameters
Type | Name | Description |
---|---|---|
IContentRepository | contentRepository |
Fields
SUBSCRIBE_INTERVAL
Declaration
[Obsolete("Constant is no longer used as part of the subscription")]
public const string SUBSCRIBE_INTERVAL = "EPSUBSCRIBE-INTERVAL"
Field Value
Type | Description |
---|---|
System.String |
SUBSCRIBE_LANG_SEP
Declaration
[Obsolete("Constant is no longer used as part of the subscription")]
public const char SUBSCRIBE_LANG_SEP = ','
Field Value
Type | Description |
---|---|
System.Char |
SUBSCRIBE_LANGUAGE
Declaration
[Obsolete("Constant is no longer used as part of the subscription")]
public const string SUBSCRIBE_LANGUAGE = "EPSUBSCRIBE-LANGUAGE"
Field Value
Type | Description |
---|---|
System.String |
SUBSCRIBE_LASTMSG
Declaration
[Obsolete("Constant is no longer used as part of the subscription")]
public const string SUBSCRIBE_LASTMSG = "EPSUBSCRIBE-LASTMSG"
Field Value
Type | Description |
---|---|
System.String |
SUBSCRIBE_PROPERTY
The name of the property that activates subscription for a page.
Declaration
public const string SUBSCRIBE_PROPERTY = "EPSUBSCRIBE"
Field Value
Type | Description |
---|---|
System.String |
Properties
Interval
Set or get interval in days for which subscriptions will be generated. Set to zero for "as fast as possible". Negative values are not allowed.
Declaration
public int Interval { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsDirty
Gets or sets a value indicating whether this instance is dirty.
Declaration
public bool IsDirty { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LastMessage
Gets or sets when the subscriptions were last sent.
Declaration
public DateTime LastMessage { get; set; }
Property Value
Type | Description |
---|---|
System.DateTime | When the subscriptions were last sent. |
SubscribedPages
Gets or sets the list of pages the user subscribes to.
Declaration
public List<SubscriptionDescriptor> SubscribedPages { get; set; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<SubscriptionDescriptor> | The pages the user subscribes to. |
Methods
CanSubscribeTo(PageReference)
Check if user can subscribe to this page
Declaration
public bool CanSubscribeTo(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink |
Returns
Type | Description |
---|---|
System.Boolean |
IsSubscribingTo(PageReference)
Check if user is subscribing to a page
Declaration
public bool IsSubscribingTo(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page to check subscription for |
Returns
Type | Description |
---|---|
System.Boolean |
IsSubscribingTo(PageReference, String)
Check if user is subscribing to a page for a certain language
Declaration
public bool IsSubscribingTo(PageReference pageLink, string language)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page to check subscription for |
System.String | language | The language string |
Returns
Type | Description |
---|---|
System.Boolean |
ListSubscriptions()
List all pages that the user subscribes to
Declaration
public PageReference[] ListSubscriptions()
Returns
Type | Description |
---|---|
PageReference[] |
SubscribeTo(PageReference)
Subscribe to a page
Declaration
public void SubscribeTo(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page to add subscription for |
SubscribeTo(PageReference, String)
Subscribe to a page for a certain language
Declaration
public void SubscribeTo(PageReference pageLink, string language)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page to add subscription for |
System.String | language | The page language to add subscription for |
UnSubscribe(PageReference)
Unsubscribe to a page
Declaration
public void UnSubscribe(PageReference pageLink)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page to remove subscription for |
UnSubscribe(PageReference, String)
Unsubscribe to a page
Declaration
public void UnSubscribe(PageReference pageLink, string language)
Parameters
Type | Name | Description |
---|---|---|
PageReference | pageLink | The page to remove subscription for |
System.String | language |