Content Studio Web Content Management System
SystemObject
ContentStudio.Document.SubscriptionSubscriptionDefinition
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Top
Top
Top
[This is preliminary documentation and is subject to change.]
This class is used to read an maintain subscription definitions related to
a category.
Inheritance Hierarchy
ContentStudio.Document.SubscriptionSubscriptionDefinition
Namespace: ContentStudio.Document.Subscription
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
The SubscriptionDefinition type exposes the following members.
Constructors
Name | Description | |
---|---|---|
SubscriptionDefinition(CategoryId, SubscriptionType) |
Initializes a new instance of the SubscriptionDefinition class.
| |
SubscriptionDefinition(ConnectionId, SessionId, Guid) |
Initializes a new instance of the SubscriptionDefinition class using a specific subscription definition identifier.
|
Properties
Name | Description | |
---|---|---|
AuthenticationSchema |
Gets or sets the authentication schema to use.
| |
CategoryId |
Gets the identifier of the category where this subscription properties are defined.
| |
ConnectionId |
Gets an integer that identifies the web site.
| |
Description |
Gets the description of the category whose subscription properties are loaded.
| |
DocumentType |
Gets the type of the document this category can contain.
| |
Enabled |
Gets or sets a value indicating whether this type of subscription is enabled for the current category.
| |
EventhandlerMoniker |
Gets or sets the event handler moniker that the Service Manager uses when it creates a
instance of an custom event handler implementation. This property can be set to
an empty string to use the built in handler.
| |
Identifier |
Gets the identifier for this subscription definition.
| |
Name |
Gets the name of the category whose subscription properties are loaded.
| |
Presentationtemplate |
Gets or sets the presentation template used when presentation the message source document.
| |
Properties |
Gets the properties defined for this subscription.
| |
Schedules |
Gets the a collection of schedule items that describes the schedule to use with this subscription.
| |
Sender |
Gets or sets the sender of the subscription message.
For email messages this should be an email address
| |
Server |
Gets or sets the name or IP-number of the server to use when distributing messages.
| |
SiteUri |
Gets or sets the site URL to when the event handler reads the document.
This value should be the base url of the site without any file names.
| |
Subscriptions |
Gets the subscriptions of this subscription definition.
| |
SubscriptionType |
Gets the type of the subscription requested.
| |
TimeOut |
Gets or sets the time out value.
| |
UserName |
Gets the name of the user that the event handler will use
while performing its task.
|
Methods
Name | Description | |
---|---|---|
AddSubscription(String, SubscriberAddress, Boolean) |
Adds the subscription to the current subscription definition without any MembershipProvider data.
| |
AddSubscription(String, SubscriberAddress, String, Object, Boolean) |
Adds the subscription to the current subscription definition.
| |
ClearSubcriptions |
Removes all subscriptions from a specific definition.
| |
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetBaseUrl | ||
GetCredentials |
Gets the credentials.
| |
GetHashCode | (Inherited from Object.) | |
GetItem |
Gets limited information about a subscribable category.
| |
GetList |
Gets a simple list of categories that can be subscribed to.
| |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
RemoveSubscription |
Removes a specific subscription by using a specific connection identifier and subscription identifier.
I.e removes a subscriber from their category subscription definition.
| |
RemoveSubscriptions |
Removes one or more subscriptions using one of more subscription identifiers.
I.e removes one of more subscriber(s) from their category subscription definition.
| |
Save |
Saves the Subscription data represented by this instance back to the underlying database.
| |
SetCredentials |
Updates the credentials used by the event handler when it executes.
| |
SubscriptionsBySubscriber |
Gets a list of subscriptions for a for the specified subscriber.
| |
SubscriptionsWithUserData |
Gets a list of all subscribable categories with information about subscriptions for a specific address.
| |
ToString |
Returns a String that represents the current SubscriptionDefinition object.
(Overrides ObjectToString.) |
Remarks
Note |
---|
This class is new in Content Studio 5.2 |
Examples
The following code sample shows how to programmatically enable a category for subscription, add a schedule and set some properties. This example works in a Content Studio document only.
//You might need to add the following using statement at the top of the class file. //using ContentStudio.Document.Subscription; try { CategoryId catId = new CategoryId(CS_ConnectionId, CS_UserSession, CS_InsertedCategoryId); SubscriptionDefinition sp = new SubscriptionDefinition(catId, SubscriptionType.Newsletter); //Enable this category for subscription sp.Enabled = true; //remove any existing schedule sp.Schedules.Clear(); //Add a new schedule effective on Monday, Tuesday and Wednesday at 12.00 and 19.00 Schedule sch = new Schedule("Schedule1", new DateTime(2008, 01, 01), false); sch.AddWeekDays(DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday); //Add the occurences sch.AddOccurences(new SimpleTime(12, 00), new SimpleTime(19, 00)); sch.Schedules.Add(sch); //Set the sender email sp.Sender = "info@ContentStudio.se"; //Add (or update) a property and its value sp.Properties.SetProperty("myProperty", "property value"); //Save the properties back to Content Studio sp.Save(); Response.Write("<div>Subscription definitions was saved successfully!</div>"); } catch(Exception ex) { Response.Write(String.Format("<div><b>{0}</b>{1}</div>", "Unable to save the subscription!", ex.Message)); }
The example below shows how to programmatically determine whether a category is enabled for subscription and how to determine the next occasion specified in the schedule.
//You might need to add the following using statement at the top of the class file. //using ContentStudio.Document.Subscription; try { CategoryId catId = new CategoryId(CS_ConnectionId, CS_UserSession, CS_InsertedCategoryId); SubscriptionDefinition sp = new SubscriptionDefinition(catId, SubscriptionType.Newsletter); string message; if(sp.Enabled) { Nullable<DateTime>nextDate = sp.Schedules.NextOccurence; message = String.Format("The category is enabled for subscription<br/>Next occurence: {0}", nextDate.HasValue ? nextDate.Value.ToString() : "None"); } else message = "The category is not enabled for subscription"; Response.Write(String.Format("<div>{0}</div>", message)); } catch(Exception ex) { Response.Write(String.Format("<div><b>{0}</b>{1}</div>", "Unable to read the subscription properties!", ex.Message)); }
See Also