Products and Services
Graffiti CMS
Learn more about our simple content publishing platform.
Harvest Reporting Server
Get business intelligence tools for measuring online behavior.
Professional Services
Consulting, creative, and Web services from the people who know Community Server best.
Solutions
Telligent
Learn more about our team at Telligent.com.
 

Tasks

Tasks are pieces of code that can be executed at specific intervals. For example, if you want to send an email every 8 hours to a group of members that reports on the current site activity, you can do this with a task. Tasks are executed automatically, so you do not need to have anyone pushing buttons to get them to execute.

The UserInvitationsExpirationJob is an example of a Community Server task. The source code for this class found at http://code.communityserver.org/?path=CS+Tree%5cCS+2007+3.0%5cComponents%5cComponents%5cUserInvitationExpirationJob.cs shows that the class implements the ITask interface. The purpose of this simple code is to expire an invitation after a certain number of days. The default is 30, so after 30 days an invitation will expire. This particular Task is set to run every 15 minutes. It calls the UserInvitation.Expire() method with a parameter indicating the number of days it runs before expiring a post.

ITask

To implement the ITask interface you need to include the following method:

public void Execute(XmlNode node)

Installation

You can place the assembly that contains your ITask inside the bin folder and then add a new entry in the communityserver.config <Tasks> node. You can have your task run on a separate thread than existing tasks, or you can include it where appropriate. A thread node can have a minutes or seconds attribute to indicate how often to execute the tasks inside the thread. The <Thread> node contains a collection of <Tasks> elements. An example of a <Tasks> entry is the following:

<task name = "UserInvitationExpiration" type = "CommunityServer.Components.UserInvitationExpirationJob, CommunityServer.Components" enabled = "true" enableShutDown = "false" expirationDays="30" />