Wednesday, April 30, 2008
Exception Handling
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
Editing web.config Programmatically
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
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
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> <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>
Site Definition Architecture
You will have to remove single quote ( ' ) from the opening and closing angle brackets to use this. Sorry for this as they were being removed when publishing.
'<'?xml version="1.0" encoding="utf-8"?'>'
'<'Project Title="My Site Definition" Revision="0" ListDir="Lists" xmlns:ows="Microsoft SharePoint" xmlns="http://schemas.microsoft.com/sharepoint/"'>'
'<'NavBars /'>'
'<'DocumentTemplates /'>'
'<'Configurations'>'
'<'Configuration ID="-1" Name="NewWeb" /'>'
'<'Configuration ID="0" Name="Default"'>'
'<'Lists'>'
'<'/Lists'>'
'<'Modules'>'
'<'Module Name="Default" /'>'
'<'/Modules'>'
'<'SiteFeatures /'>'
'<'WebFeatures /'>'
'<'/Configuration'>'
'<'/Configurations'>'
'<'Modules'>'
'<'Module Name="Default" Url="" '>'
'<'File Url="default.aspx" NavBarHome="True" Type="Ghostable"'>''<'/File'>'
'<'/Module'>'
'<'/Modules'>'
'<'/Project'>'
Web Part Class/Assembly Details
This is how! Try to add this webpart on your page through EditPage action. Once you have added you can now Export this webpart and open the .webpart file in a notepad. There you will see something like this:
'<'assembly'>'Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'<'/assembly'>' '<'typename>Microsoft.SharePoint.Portal.WebControls.QuickLinksMicroView'<'/typename'>'
Here Typename is the class name of the webpart. And this is for a My Links webpart. This will come handy manytimes when the name of Webpart class is different from the name in webpart gallery (Which is the case most of the time)
Finally got started
Hi All,
Finally bolgger world has pulled me to start my own blog. I have been thinking this for so long and now my self motivation has forced me to create my knowledge sharing place. I have created this blog to share any issues , solutions, tricks etc..that I find when working on MOSS projects. I hope this information will be helpful to some of you and will save some time.
Will try my best to actively post any solutions or tips I find or come across.
Oh yeah! and just to start with - tomorrow is a SharePoint UserGroup happening in Canberra. Patrick Tisseghem is in town and will be delivering a session on Customizing Search page and results. Check this: http://www.sharepointusers.org.au/Canberra/default.aspx
I am defi going for this session and will try to share some information on here.