This is the first in a series of posts on building custom portlets for the Sense/Net Portal Engine TNG. The good news is: it is as simple as it can be and all you have to do is to subclass from the SenseNet.PortalEngine.Portlet class, implement your custom portlet logic with C# code and then place yours assembly in the portal application assembly discovery path (for example the Bin folder). That's it. As for the bad news there is no bad news here as the Portal Engine TNG Portlet API is basically the ASP.NET WebPart framework, extended with some Portal Engine TNG specific services and tools to simplify development, deployment and maintainance of WebPart based applications.
In these documents it is assumed that you are new to both the WebPart and the Portal Engine TNG technology but you bear with at least a minimal understanding of the ASP.NET Custom Control concept.
So here are the steps for creating a portlet that can be placed on a portal page and will say "Hello World" to me.
1) Create a C# library project
2) Reference to following assemblies: PortalEngine.DLL, PortalFileSystem.DLL and System.Web.
I deleted the auto created Class1.cs but this step is not obligatory.
3) Create your portlet class with adding an new class file, for clarity sake let's name it MyCustomPortlet.cs. In your class file create your class definition "MyCustomPortlet" and subclass it from the SenseNet.PortalEngine.Portlet class. Now we have a technically complete and working portlet only that it does not do anything at this point - however it does this nothing on a very elegant way.
4) Let's extend our portlet, so that it _does_ something, let's say hello world. To say anything we need a channel to speak into, in this case this will be the HttpResponse. To intercept the request/response cycle so that you can have your output submitted you need an entry point, in our case this is the Render method of our newly generated portlet.
5) We are almost done, now we only need to build or newly forged portlet to an appropriate place so that the TNG portal can find it.
6) Placing our portlet onto a page. This is the last step and is not a part of the usual portlet development process but is required if we want to see our Hello World written on a web page :) Haven't you noticed anything? No? Really? Well step 5 was about building our new portlet and in step 6 we are already using it? Where comes the dirty part? Like writing complicated config files or creating install packages with X tool to utilize them later with Y tool? The point here is that beyond placing your portlet into to right directory you don't have to do anything particurlar for your web part to appear as a selectable new portal element. That simple it is.