Thursday, November 30, 2006

Changes that you make to the "List View" Web Part are not retained after you save the site as a template

For those of you without the time to read the original article, basically what happens - when you save a site as template, the settings for web parts displaying lists are not always saved.

I had planned to post about this today and rant about how microsoft missed this, but they beat me to it and acknowledged this bug in the KB Article.

I just hope they give us a quick fix and we dont have to wait untill service pack. This really "uglies" our solutions.

Sunday, November 26, 2006

Plan for administrative and service accounts [Office SharePoint Server]

Ran across this great technet article explaining exactly what accounts you will need to set up sharepoint in production, and what level of permissions to give each one.

Search Highlighting For MOSS2007 (and 2003) - Update

This is an update to a year old post about a product that I helped write - the SharePoint Search String Highlighter. Apperantly my friends in KwizCom have added support to MOSS2007!

Before you say "but moss has search highlighting", let me remind you that this solution also highlights in the documents (word and pdf), and can also help you solve a problem that is usual with search results - make sure the links open in word and not in the browser (I hate when that happens).

So take a look - tell me what you think...

Wednesday, November 22, 2006

Announcing the SharePoint Tips Utility Pack!

update (13.2.2006)
I moved the download and released the open source to a codeplex open source project.
I also released version 1.1 which has some improved features on the field settings screen.

update (1.12.2006) - I moved the utility pack download to a better host- the Canberra SharePoint User Group site (which is where the application was first announced).
Please be patient when clicking the download link, as the user group site was not meant to be a file host and I guess the download can take a while to begin - but its a small file so when it does begin it wont take long.
I am also in contact with Microsoft to get the source code on codeplex - so stay tuned!

Its that time again - time for me to give away something I did for myself to the public.

This time its a pack of small utilities made to make life easier for me as a sharepoint 2007 deployer\administrator\consultant. I am constantly working on small utilities and scripts like these, and now I packaged some of these and I am letting you download it for free. At your own risk.

So hurry and download the SharePoint Tips Utility Pack. I will move the file to another file host service when I find a better one.

Oh, before I forget- to run this application you must run it on to the sharepoint server itself, and to set the trust level in the web.config file to "Full" or sharepoint will not allow the application to get to the data...

Here is what you get in the pack:

  1. A utility to push web parts to existing sites
  2. A utility to create lists in existing sites
  3. A utility to delete sites recursively
  4. A utility to change list fields settings

I also plan to add to it my utility to register event handlers to lists - coming soon!
So please remember - I am open to suggestions and when I am able I will release the source code for the community benefit. kick it on

Sunday, November 19, 2006

Help needed to design a community tool

Below is an image of a tool I have been working on for my own use, and I thought to release to the community as open source utility.

The objective - deploying webparts to web part pages in sites, using code and not using masterpages (not all sites have same master page, and also if you use master page to deploy a web part you complicate changing one site in the bunch...) in sharepoint 2007.

So the screen shot is of the options I came up with so far to answer what I needed to do and set. If you have any more ideas for options to put on the screen - comment to this article and I may find the time to include them before I release this to the public!

Waiting for your commnets!

Thursday, November 16, 2006

Happens every time - adding a web part class to a project

I hate it when I dont learn from my bad experience...

When I have a solution with a web part and I want to add another web part to the same project I just right click the project, select "Add" and choose "Class". Then I tell the class to inherit from "WebPart" and proceed to program my code.

And when I get to deploying it - the new class isnt shown in the new webparts gallery!


because I forget every time to mark the class as "public" - when Visual Studio creates a new class in a project, the default is just "class newwebpart".

So the lesson for today - dont beat yourself going over the web.config file - just make sure the class is marked public.

WSS & MOSS RTM are out to download

Well, if you have been following my blog you probably noticed that I avoided linking to new downloads of the beta as they got released. I hate it when all bloggers say the same thing at once and my RSS reader shows 600 new articles- all links.

But this is different. SharePoint 2007 is available as a public download (trial version) and so is WSS3.

  1. Microsoft Office SharePoint Server 2007 Trial Version
  2. Windows SharePoint Services 3.0

Happy days...

And just so this post isnt just a lame linking post I will update you that I am working on part II for my popular "Simple Code Samples" article. I have some code samples on security, and on lookup fields that I feel are essential to any sharepoint developer.

Also coming soon (very soon) - some new free downloads of some tools I have written for some of my projects to make my life easier.

See you soon!

Monday, November 13, 2006

Answer to comment - how to specify a category to a site template

Someone name "Seth" asked me today how to specify a category for a site template. Unfortunately Seth forgot to leave his email or contact number, so I will answer publicly.

I dont know how to do it for a saved template (saved by the "save as site template" function in site properties). But I do know that using Site Definitions its possible. Site definitions are registered by adding an xml file under "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\" folder. The xml schema that declares a template looks like this:

<Template Name="SPSSITES" ID="34">
<Configuration ID="0" Title="Site Directory area template" Type="0" Hidden="FALSE" ImageUrl="/_layouts/images/template_site_dir.gif" Description="This template creates a site that lists important sites in your organization. It includes different views for Categorized Sites, Top Sites and the Site Map." DisplayCategory="Enterprise" />

Notice anything bold? thats where you choose the category for the site template.
Using the new Visual Studio 2005 Extensions you can save a site into a site definition, and then change the xml as needed.


Thursday, November 09, 2006

Sharepoint list forms and adding web parts and our Sub tasks solution

Lately I have been testing adding web parts to list forms and discovered an interesting thing:

I have been involved with doing a nice solution for sub-tasks in sharepoint 2007 and the way we did it is develop a web part to put on the "display form" that queries the task list for items with the "parent task" field pointing at the current displayed task.

Adding that web part to the display form wasn't a problem - just open the form in Sharepoint designer, add a web part zone to the side and drop the new web part there.

Then I wanted to add a web part to the "new task" form, that gets from the querystring which task it should connect to, and set the value to the "parent task" field automatically. To my surprise, I found that if you try to put it on the form, the page crashes with an error.

Before you say "Ishai, you write lousy code" I have to stop you and say I tried adding default sharepoint web parts as well, and the end result of the research is that when you add web parts to a page that has either the "edit" or the "new" list forms - the page will crash.

Whats the workaround? we moved the code from a web part to a web control, and manually added it to the page. Works like a charm, and now we have a viable tasks-sub tasks solution. I will publish what I can of the code after testing.

Here is what our solution looks like:
Creating a new task:

View that task, currently no sub tasks were created:

Click the "Create sub task" link and you get to the "new task" page again:

View the root task again, this time you see the sub task in the side web part:

Another option to create the sub tasks - through a context menu:

I want to mention that two developers have been working with me on those web parts- I want to thank Adam Tibballs and Steven Pavlovic for their time and effort.

Tuesday, November 07, 2006

Synchronous list event handlers ruin datasheet view

I have written a synchronous list event handler, using the ItemUpdating event to manipulate some data. Now when I try to edit data in the datasheet view I get conflict errors, and I cannot save my changes. Using the regular edit form works. I guess this is a problem in the product, and I hope it will be fixed in RTM. However, since I couldn't find anything about it on the news groups, I guess no one reported it and MS may not know about it.

On a similar matter, some people have been telling me that my code sample for updating list items without firing the events doesnt work for them. I suspect the problem is with different events. The synchronous events ("ing"s) require you to edit the afterproperties, while the a-synchronous ones ("ed"'s) require you to edit the item itself.

Here is a code sample from an event handler I wrote. its not perfect, but its a good sample for what you need to work on.

SPList list; SPListItem item;
switch (properties.EventType)
case SPEventReceiverType.ItemAdded:
list = properties.ListItem.ParentList;
item = list.GetItemById(properties.ListItemId);
item[siteLinkFieldName] = itemSiteWrapper.SiteLinkFormatted;
case SPEventReceiverType.ItemAdding:
case SPEventReceiverType.ItemUpdated:
list = properties.ListItem.ParentList;
item = list.GetItemById(properties.ListItemId);
item[siteLinkFieldName] = itemSiteWrapper.SiteLinkFormatted;
case SPEventReceiverType.ItemUpdating:
properties.AfterProperties[siteLinkFieldName.Replace(" ", "_x0020_")] = itemSiteWrapper.SiteLinkFormatted;