SubscriptionDefinitionGetList Method Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Gets a simple list of categories that can be subscribed to.

Namespace: ContentStudio.Document.Subscription
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public static ReadOnlyCollection<SubscriptionDefinitionListItem> GetList(
	ConnectionId connectionId,
	SessionId sessionId,
	SubscriptionType type
)

Parameters

connectionId
Type: ContentStudioConnectionId
A value that identifies the web site
sessionId
Type: ContentStudio.SecuritySessionId
A value that identifies the user's session. This value typically is retrieved from a call to the OpenSession method
type
Type: ContentStudio.Document.SubscriptionSubscriptionType
The type of subscription to load.

Return Value

Type: ReadOnlyCollectionSubscriptionDefinitionListItem
A ReadOnlyCollectionT of SubscriptionDefinitionListItem object that represents a category that can be subscribed to.
Exceptions

ExceptionCondition
NotSupportedException The type parameter contains an unsupported value.
SqlExceptionAn error occurred when executing the command against the Content Studio database
Content Studio permissions

Anyone, including anonymous caller, can successfully execute this method.
Remarks

This method acts as an object oriented wrapper over the low level GetSubscribableCategories(ConnectionId, SessionId, SubscriptionType) method that returns the same data in its raw xml-based data format.
Note Note
Categories that are not enabled but have a subscription definition are excluded from this list.
Examples

The following small sample shows how to get a list of all categories on a Web site that can be subscribed to and write the list into an Html-table. This sample only works in a Content Studio document

//You might need to import the following namespaces
//using System.Collections.ObjectModel;
//using ContentStudio.Document.Subscription;

try
{
  ReadOnlyCollection<SubscriptionDefinitionListItem> items = 
    SubscriptionDefinition.GetList(CS_ConnectionId, CS_UserSessionId, SubscriptionType.Newsletter);
  Response.Write("<table>");
  Response.Write("<tr>");
  Response.Write("<th>Name</th>");
  Response.Write("<th>CategoryId</th>");
  Response.Write("<th>Identifier</th>");
  Response.Write("<th>Description</th>");
  Response.Write("</tr>");
  foreach(SubscriptionDefinitionListItem suli in items)
  {
    Response.Write("<tr>");
    Response.Write(String.Format("<td>{0}</td>", suli.Name));
    Response.Write(String.Format("<td>{0}</td>", suli.CategoryId));
    Response.Write(String.Format("<td>{0}</td>", suli.Identifier));
    Response.Write(String.Format("<td>{0}</td>", suli.Description));
    Response.Write("</tr>");
  }
  Response.Write("</table>");
}
catch(Exception ex)
{
  Response.Write(String.Format("<h3>Error while reading subscriptions</h3><div>{0}</div>", ex.Message));
}
See Also

Reference