April, 2011

Using SPSiteDataQuery to find list items by unique ID

In one of my projects I had to search for list item from current site collection by its unique ID that is kept in database as GUID. In this posting I will show you how to query list items by unique ID over current site collection.

Dumping DataTable to debug window

Here’s one little method I use to write out debug information when investigating some new (legacy but new to me) system. Usually I remove this method later when I know how code works. It’s maybe not the best way to debug things but it works like charm in many situations.

Creating tag cloud using ASP.NET MVC and Entity Framework

I am building events site on ASP.NET MVC 3 and Entity Framework. Today I added tagging support to my site and created simple tag cloud. In this posting I will show you how my tag cloud is implemented. Feel free to use my code if you like it.

ASP.NET MVC 3: Using controllers scaffolding

ASP.NET MVC 3 Tools Update introduces support for controllers scaffolding with views and data access code. Right now I am building one very simple web site for free tech events and as I am building it on ASP.NET MVC 3 I have good testing polygon right here. In this posting I will show you how controller scaffolding works and what is the end result.

ASP.NET MVC: Defining short URL-s for root level pages

Short URL-s are more and more important part of page usability as mobile internet is growing. Long URL-s are not convenient to type due to small keyboards and screens of mobile devices. Also short URL-s are easier to remember and using well chosen short URL-s your pages may also get better rankings in search engines […]

ASP.NET MVC 3: Intranet Application template

ASP.NET MVC 3 Tools Update introduced new project template called Intranet Application. The main difference between internet and intranet application templates is the way how users are authenticated. In this posting I will talk about Intranet Application template and compare it to Internet Application template. Also I will give you references to guides that help you configure your intranet application.

10 interactive SharePoint 2010 labs by Microsoft

Microsoft has published some simple and nice interactive labs under title Build a better app that help you to get started with SharePoint 2010 development on Visual Studio 2010. Each lab should take about 15 minutes of your valuable time.

ASP.NET MVC: Using NonActionAttribute to restrict access to public methods of controller

Public non-action methods in ASP.NET MVC controllers are source of problems because they can be called by user when not handled carefully. Same time you may need public methods on controllers for some other reasons (some UI framework, testability problems, things you cannot change etc). In this posting I will show you how to handle controller methods properly.

Unable to locate the xml-definition for CType with SPContentTypeId

When deploying your SharePoint solution to your development or test server where solution has been deployed before you may find errors like these in SharePoint log:Unable to locate the xml-definition for CType with SPContentTypeId and Failed to find the content type schema for ct-0-0x010100 during template lookup.

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive

When IIS is not configured properly after creating SharePoint application and there are web parts or features that use session you may get the following error: Unexpected error occured: System.Web.HttpException: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make […]

Failed to get value of the "Approval Status" column from the "Moderation Status" field type control

When upgrading site from SharePoint 2007 to SharePoint 2010 or if somebody has tried to be extreme smart-ass you may get the following error when saving item or document to list where content approval is turned on: Failed to get value of the “Approval Status” column from the “Moderation Status” field type control. See details in log. Exception message: Input string was not in a correct format.

Users are registered but not authenticated when using FBA and claims-based authentication

Configured one SharePoint 2010 web application to use FBA with claims-based authentication. I also created extended application that is internally used as for administrative purposes. On public site users were registered but never correctly authenticated for SharePoint. Solution is here.

Cannot use SharePoint 2010 API from console application

Suppose you create new console application using Visual Studio 2010 and add reference to SharePoint 2010 main library. When you run application you get the following error: Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)). Same error may […]