Friday, March 28, 2008

Content Type ID's

You are right - we all know how Content Type Id's are constructred. But let me post it here again:

The first part of a CT ID is based on a hexadecimal number that identifies its base content type (see list below) followed by 00 as a seperator. The last part of a CT ID is a GUID that uniquely identifies the CT. For each level o inheritance the seperator will be added to the end of the ID plus another GUID.

So, that's easy and actually not the reason why I wrote this entry. Main reason is, that I always have to look up the base intheritance ID's. So the list below will be my point of contact to get the right ID's easily. Maybe you can use it too:


Basic Types:
  • 0x System
  • 0x01 Item

List Types:

  • 0x0102 Event
  • 0x0103 Issue
  • 0x0104 Announcement
  • 0x0105 Link
  • 0x0106 Contact
  • 0x0107 Message
  • 0x0108 Task
  • 0x0110 BlogPost
  • 0x0111 BlogComment

Document Types:

  • 0x0101 Document
  • 0x010101 Form
  • 0x010102 Picture
  • 0x010108 Wiki Document
  • 0x010109 Basic Page
  • 0x01010901 WebPart Page

Folder Types:

  • 0x0120 Folder
  • 0x012001 RootOfList
  • 0x012002 Discussion

Sunday, March 23, 2008

Microsoft TechDays Switzerland 2008

This years TechDays were taking place Wed and Thursday this week in Basel. The Sessions and Tracks were very interesting and again something no .NET developer should miss!

About the location - hmmm, the whole thing was taking place in sporthalls in the underground and yes I also think there could be better and nicer places for this event - maybe next year.

For all who did not have time to go to the TechDays I want to say that beginning of next week you will be able to download all presentations from the TechDays Homepage!!! I really recommend the Developer Tracks!!! Have a look

As usual, here are my "Best of TechDays":

Best Session:
Visual Studio 2008 für Web Anwendun­gen
from Sacha P. Corti

Best Speaker:
Ingo Rammer
thinktecture

Best News:
Future of distributed .NET Solutions
from Chris Horrocks



So let's stay tunned!

Microsoft AJAX Extensions and SharePoint Webparts - what a great team ;-)

Alright, here is a new topic for all of you guys need to include AJAX-functionality into your SharePoint Webparts. Just to say it right away: It is a long and anoying way - but when you finally got your AJAX enabled webpart up and running - your feeeeeeeelllll great!!!

So, lets's keep it short... these are the steps you need to get the Microsoft AJAX Extensions running on your SharePoint installation:

  1. Download and Install the Microsoft ASP.NET AJAX Exentsions from http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&displaylang=en
  2. Follow the steps posted from Mike Ammerlaan to configure the web.config file(s) of your SharePoint Web Application - I recommend to do only the web.config bits and pieces explained on this blog: http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3
  3. As you know, ASP.NET AJAX Framwork needs a Script Manager Object on each side hosting AJAX functionality. Even if the following Function works for most cases, I recommend you put the ScriptManager to your Master Page(s) - I really do. If you dont want to, you can try the following method (call it during your CreateChildControls activity to ensure that at least one Script Manager is present and registred):

private void EnsureScriptManager(){

ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);

if (scriptManager == null) {

scriptManager = new ScriptManager();

scriptManager.EnablePartialRendering = true; this.Controls.AddAt(0, scriptManager);

}

}

Et voila - AJAX is ready to be used... but one thing is left to say concerning the Update Panel (which you will most probably use):

  1. To fix another issue with SharePoint and the Update Panel, I wrote another function to ensure this fix. Same as the previous function you can call it during the CreateChildControls method:

public static void EnsureUpdatePanelFixups(WebControl Parent)
{
// PostBack Fix
// Found here: http://www.capdes.com/2007/02/microsoft_office_sharepoint_se.html
Parent.Page.ClientScript.RegisterStartupScript(typeof(WebControl), "PostbackFix", "_spOriginalFormAction = document.forms[0].action;", true);

// Panel Fixup
if (Parent.Page.Form != null)
{
if (Parent.Page.Form != null)
{
string formOnSubmitAtt = Parent.Page.Form.Attributes["onsubmit"];
if (!string.IsNullOrEmpty(formOnSubmitAtt) && formOnSubmitAtt == "return _spFormOnSubmitWrapper();")
{
Parent.Page.Form.Attributes["onsubmit"] = "_spFormOnSubmitWrapper();";
}
}
}
}

Hope that helps to give you a first go on Microsoft APS.NET AJAX-enabled Webparts! As you will see, there are more traps and unbelievable shity things you will encounter during your AJAX implementation - but you will finally be very very pleased with the new User Experience!

Have FUN