Saturday, May 31, 2008

MCTS WSS 3.0

It was a great week! I have now successfully completed my WSS 3.0 Application Development
(70-541) certification. Few preparation tips:

-Read Inside WSS 3.0 by Ted Pattison . This is a great book and will give you a very good understanding of the concepts Windows SharePoint Services 3.0.
-I have completed all the Microsoft E-Learning courses mentioned in the program guide of
70-541. There are two collections 5385 and 5392. These collections will help you in understanding concepts further.
-Having hands on experience for 6 months on a project will help you for sure.
-Understand complete SharePoint object model.
-Try creating Site Definition manually, understand Onet.xml completely.
-Play with features, web parts and workflows.
-A little understanding of deployment procedure using solution packages.

Wednesday, May 21, 2008

Quick Tip: Web Service to SharePoint Data

If you want to use web services to manipulate data on your SharePoint site, you must always allow unsafe updates on your site and then disable unsafe updates after making changes.

Want to know more on AllowUnsafeUpdates, check this

Wednesday, April 30, 2008

Exception Handling

In Sharepoint specially when writing WebParts and Event Handlers exception handling should be done properly else you get mixed results. Try to catch exceptions in two parts one is SPException type and another is SecurityException type.

There is a very good tool called as FxCop. This application checks for if the exception haldings and naming conventions are as per Microsoft Stadards or not. Want to know more about FxCop? Go Here!

Monday, April 28, 2008

Finally REMIX

Finally Microsoft REMIX is in Australia too. Here you will get to see next generation websites developed using Silverlight 2, Expression 2, IE 8 and more. You can register here at REMIX


Editing web.config Programmatically

Today after finishing the webpart development when the time came to deploy them, I realised that everytime I deploy these webparts on another server I have to add SafeControl in web.config manually again and again. Did some research and found some good articles. SPWebConfigModification is the class that we can use to modify the web.config file.

Mark Wagner has dotted down some good best practices to do this. Check here

Ted Pattison has also written some great details about the complete process to do it and he has also uploaded a sample feature to do this. Check here

And if you are still not satisfied then read more information about SPWebConfigModification on msdn

Link to an item when running SPSiteDataQuery

Many a times we will need to run SPSiteDataQuery on a list to get the results from a sitecollection. Now once we have retreived the results from the query we need to get the url of each item. There is a hidden column "EncodedAbsUrl" which consists of complete URL to an Item. For some reason accessing this column doesn't give us the complete URL that we need (I don't know why). But there is another trick to get the URL of an item. There is another hidden column "FileRef" in each list. This column data has got the URL with the item ID concatenated to it, something like this:

row["FileRef"] = 1;#Popular Wiki/How To Use This Wiki Library.aspx

**row is from the datatable returned when you run web.GetSiteData(query) and query is the constructed SPSiteDataQuery.

We can retreive the URL part from it and construct the complete link from the root site. Something like this:

string url = row["FileRef"].ToString().Substring(row["FileRef"].ToString().IndexOf("#") + 1);

string finalUrl = site.MakeFullUrl(url);

You can read more about MakeFullUrl() method here msdn

Tuesday, April 15, 2008

Creating WebPart instances in Custom Site Definitions

Cool Stuff! I have just found or I should say "I just came to know" that we can create a webpart instance on the default page of a site right in the Site Definition. Consider a scenario where you are having a Custom Site Definition and you wish to put some standard webparts for all the users when a site is created using this Site Definition->Site Template. You can do this in two ways one is the through the object model using SPLimitedWebPartManager class and another is via CAML in site definition. I will explain via CAML way in this post:

If you have seen my previous post on Site Def architecture, we have got Modules node:

<Modules> <Module Name="Default" Url="" >
<File Url="default.aspx" NavBarHome="True" Type="Ghostable"> </File>
</Module>
</Modules>

Now under File node we have <AllUsersWebPart> node available. This is the key to add any webpart instances. Below is the example:

<AllUsersWebPart WebPartZoneID="Right" WebPartOrder="0">
<![CDATA[
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"
xmlns:iwp="http://schemas.microsoft.com/WebPart/v2/Image%22&gt; <Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> <TypeName>Microsoft.SharePoint.WebPartPages.ImageWebPart</TypeName> <FrameType>None</FrameType>
<Title>Home Page</Title> <iwp:ImageLink>/_layouts/images/CONTACT.PNG</iwp:ImageLink> </WebPart> ]]>
</AllUsersWebPart>

Dogpile
Powered By Blogger