Archive for August, 2010

Create DNN Schedule in Code

August 28, 2010 Leave a comment

In one of my previous posts, i described the mechanism to schedule a tasks in DotNetNuke.

DNN provides a user interface to create and manage scheduled tasks (a.k.a Schedule Items), you can access the schedule items by logging in as Host and navigating to Host -> Schedule. You can manage already created schedule items here and you can create new schedule items as well.

But, if you want to create a schedule item in code, following piece of code will help you.

Code: Create Schedule Item

private DotNetNuke.Services.Scheduling.ScheduleItem CreateScheduleItem(
    String friendlyName,
    String typeFullName,
    String objectDependencies,
    int timeLapse,
    String timeLapseMeasurement)
    DotNetNuke.Services.Scheduling.ScheduleItem objScheduleItem =
        new DotNetNuke.Services.Scheduling.ScheduleItem();
    objScheduleItem.FriendlyName = friendlyName;
    //ONLY Supported in 05.02.xx and above versions

    objScheduleItem.TypeFullName = typeFullName;
    objScheduleItem.TimeLapse = timeLapse;
    objScheduleItem.TimeLapseMeasurement = timeLapseMeasurement;
    objScheduleItem.RetryTimeLapse = 1;
    objScheduleItem.RetryTimeLapseMeasurement = "m";
    objScheduleItem.RetainHistoryNum = 100;
    objScheduleItem.AttachToEvent = "";
    objScheduleItem.CatchUpEnabled = false;
    objScheduleItem.Enabled = false;
    objScheduleItem.ObjectDependencies = objectDependencies;
    objScheduleItem.Servers = Null.NullString;
    return objScheduleItem;

Code: Add the Schedule Item to DotNetNuke

DotNetNuke.Services.Scheduling.ScheduleItem item =
CreateScheduleItem("Test Item", "TypeFullName", "", 10, "m");

int scheduleID = 

Schedule a Task in DNN

August 23, 2010 1 comment

DotNetNuke provides a robust framework for scheduled tasks. Some tasks are already scheduled by DotNetNuke installation and you can also add your own custom tasks to the DotNetNuke schedule.

DotNetNuke schedule is accessible from the Host -> Schedule screen. This screen lists all of the scheduled tasks also called schedule item. You can see status, history and properties of each schedule item.

You can find more details about DotNetNuke Scheduler in this PDF document.

You can find more details about creating a DotNetNuke schedule item in following posts:

The first step in creating a Schedule Item is to create a DotNet Assembly that will contain the logic to execute the scheduled task. Your class for task execution should inherit from DotNetNuke.Services.Scheduling.SchedulerClient. Once the Assembly is ready, you can create a new Schedule Item by going to Host -> Schedule -> Add Item to Schedule.

Export DataTable to PDF

August 8, 2010 Leave a comment

In one of my previous posts Create PDF Documents in ASP.NET, I explained how we can create PDF document in ASP.Net applications.

By using the open source iTextSharp library, i have created a class to export a Data Table to PDF document. This is an initial version of the utility class. This can be used to export a Data Table to PDF document in the form of table. This class uses iTextSharp dll for creating PDF document. To start using this utility, you will need to download the iTextSharp library from and reference it in your project.

Click here to download source code for DataTable2PDFDocument.

Create PDF Documents in ASP.NET

August 7, 2010 Leave a comment

If you want to create PDF documents in your Dot Net web/desktop application, without purchasing any 3rd party control, then iTextSharp is the right choice for you. iTextSharp is an open source library distributed under GNU Public License. You can freely use this component in your personal and commercial applications.

iText# (iTextSharp) is a port of the iText open source java library for PDF generation written entirely in C# for the .NET platform. Use the iText mailing list to get support.

Project page at SourceForge contains DLL and source for this nice library.  You can also find some example projects on the files page.

You can find a brief article and source code example on a code project article Creating PDF Documents in ASP.NET

Please note, iTextSharp is useful where you want to create a PDF document with custom text. With iTextSharp you will have to create the text for PDF in code (see examples or code project article for details). But if you want to convert HTML text or a HTML page to PDF directly, you will either have to extend iTextSharp or you will have to use some other component or library, you can give a try to ABCpdf.Net for conversion purposes.

If you want to use iTextSharp to convert HTML to PDF, you can start it by reading a very good article “iTextSharp – Simplify Your HTML to PDF Creation” at

I am working on a generic control that will create a PDF file from a DataTable, i will share the control once it is ready.

Categories: ASP.Net, PDF Tags: , , ,

Sending a Meeting Request

August 4, 2010 Leave a comment

Recently i came across a requirement where we need to send meeting/event invitation in email. Previously, i used to create ICS/iCal file with meeting/event information and this file was attached with the email. End user had to open the attached file to add it to calendar program. But sending an inline (native) meeting invitation was kind of a new requirement. See sample meeting invitations screen below:

Sample Meeting Request Gmail

Sample Meeting Request Gmail

Sample Meeting Request Outlook

Sample Meeting Request Outlook

Following post helped me in understanding the process to send inline meeting invitations/requests.

I have created a class (with the help of code mentioned in above post) to wrap up the functionality of meeting requests. Code can be downloaded here.

Usage of this class is very simple, e.g. if you want to send a meeting request from ASP.Net code, simply call the method in following manner:

MailMessage msg = KP.Web.Mail.CalanderInvite.GetCalanderInviteMsg(“”, “From Name”, “”, “To Name”, “SUBJECT”, “BODY TEXT”, DateTime.UtcNow.AddHours(2), DateTime.UtcNow.AddHours(3));