Tuesday, July 8, 2008

Wildcard Search in MOSS

Earlier this year I was asked to implement wildcard people search in MOSS. The solution I went with wasn't pretty and I wish I could go back and do it again. If I could do it again I would try to use the method outlined in this article with some customisations to make it work for People Search: Web Part for Wildcard Search in Enterprise Search

The way I had originally gone about it was to create a custom people search box based on this article. It worked really well EXCEPT that if any of my criteria were null for the person but they met other search criteria they would not show up in the results.

Tuesday, June 17, 2008

.NET and SharePoint Interview questions

My list of .NET and SharePoint interview questions

.NET Questions

Describe what an Interface is and how it differs from a class.



What is polymorphism?



What is reflection



How is the using() pattern useful? What is IDisposable?




What is an abstract class?




Can you name some major ASP.net objects: Session, Page, Server, Response, Request, Application




Can you describe the ASP.NET page lifecycle? What methods are fired during the page load? Page request, Start, Page Initialisation, Load, Validation, Postback event handling, Rendering, Unload. PreInit, Init, InitComplete, PreLoad, OnLoad, control events, LoadComplete, PreRender, SaveStateComplete, the page calls Render for each control, Unload




How do you store information across postbacks? What different ways are there? Which one do you prefer and why? ViewState, Query Strings, Application, Session




What is an n-tier design? Can you give an example?
What is AJAX? Have you used it? Examples?




Can you used application blocks in your programming? Which ones?




Patterns?



SharePoint Questions

What are content types and how are they used? Can you give me an example of where you have used them?




What elements does SharePoint provide to allow you to define the look and feel of a publishing site? Master Page, Page Layouts, Content types, CSS




How could you display information from a list on one site on another site in the same site collection? Dataview, CQWP, RSS.




Why would you want to extend a web application?




What is the 12 hive OR can you tell me where SharePoint stores it’s files




Are you familiar with the file onet.xml? What is it? Site Definition file




What is a Feature




What is a Solution




What is SPWeb, SPSite. Can you tell me anything special that a developer must keep in mind when using these objects in code?




What is SharePoint Designer? How have you used it?

Sunday, May 25, 2008

Closed web part gallery

Are you trying to find the closed web part gallery? I was, then I found it here:

1. Click on Edit Page
2. Click on Add Web Part
3. When you get the list of web parts that are available, click on Advanced.
4. Now you will see any web parts that were closed

Wednesday, May 14, 2008

Branding meeting workspaces

I recently had an issue where I created a master page and tried to apply it (using feature stapling) to sites based on meeting workspace site templates. The lessons learnt from this were:

  1. Meeting workspaces don't use default.master. They use MWSdefault.master. Base the master page for meeting workspaces on MWSdefault.master as it has extra functionality specific to meeting workspaces.
  2. When setting the master page programatically, you need to set two properties as follows:
    web.MasterUrl = "something.master";
    web.CustomMasterUrl = "something.master";
    For sites based on other site templates I only had to set web.MasterUrl.

Monday, May 12, 2008

Wednesday, May 7, 2008

Dispose of SPWeb and SPSite objects

When coding in SharePoint you should ALWAYS dispose of SPWeb and SPSite objects. They use a small amount of managed code and a large amount of unmanaged code. As a result of the small managed code, the garbage collector doesn't clear out the items from memory which can lead to a world of pain...

Best Practices: Using Disposable Windows SharePoint Services Objects

SharePoint Data Protection and recovery

White paper: Data protection and recovery for Office SharePoint Server in small to medium deployments

Web Parts and User Controls

UPDATE 4 July 08: Came across an article by Damon Armstrong about Simplifying Web Part Development using templated web parts. Pretty cool way of doing user controls with web parts. End of update.

I wanted to create a webpart but be able to design it visually in Visual Studio. I was thinking that to do this should be easy - I can just create a web user control, and then wrap the web part around. Was it easy? Kind of.

I also wanted to have this web part in a Sharepoint solution (ie .wsp file).

The approach I took was as follows:

1. Use STSDEV to create a solution with a web part feature. I'm a big fan of this tool!!!!
2. Create the user control .ascx file and add it into the folder structure created in the STSDEV tool. I added it to the TEMPLATE > CONTROLTEMPLATES folder.
3. Programatically added the user control to the webpart.
4. Deployed the solution.

I am going to focus on points 2 and 3 above. There are plenty of good articles out there already on how to use STSDEV to create solutions and features.

Creating the User Control
To create the user control I just added in a new file to the project called SiteList.ascx. At the top of the file I added in the @Control directive as follows:

"< %@ Control Language="C#" AutoEventWireup="true" CompilationMode="Always" % >"

Note that I am not using a code behind file.

I then added the rest of the code to this file as follows:





The solution (using STSDEV) will deploy this SiteList.ascx to the 12 hive\Template\ControlTemplates folder.

Adding the user control to the web part

This bit is easy. Just write the CreateChildControls() method as follows:

protected override void CreateChildControls() {
UserControl sitelist = (UserControl)Page.LoadControl(@"/_controltemplates/SiteList.ascx");
Controls.Add(sitelist);

That's it. It is a very simple example but it works for me.

Tuesday, May 6, 2008

Remix 08 Sydney

I'm looking forward to attending the Remix 08 conference in Sydney later this month to learn more about Silverlight and Expression Blend with a view to creating web parts for SharePoint that use it. Should be fun.

Site Enumeration

Site enumeration blog post

Sunday, May 4, 2008

Site Template references

So I don't have to spend time searching for this info each time I want to do feature stapling:

STS#0 - Team Site
STS#1 - Blank Site
STS#2 - Document Workspace
MPS#0 - Basic Meeting workspace
MPS#1 - Blank meeting workspace
MPS#2 - Decision Meeting Workspace
MPS#3 - Social Meeting Workspace
MPS#4 - Multipage Meeting Workspace
WIKI#0 - Wiki Site
BLOG#0 - Blog site

Custom Navigation

Here is a link to a good presentation about how to customise SharePoint navigation http://www.jornata.com/presentations/cardarelli_buildingcustomnavigation.ppt

First time

This blog is for me to post stuff about SharePoint as I find it. It is a central place for me to accumulate sharepoint wisdom so that I can maybe find it again when I have forgotten about it.