Tuesday, December 13, 2005

HtmlDesignerAttribute: Custom Property Builders for SharePoint Web Parts


There are occasions when it may be necessary to provide web part users with a richer interface for setting custom properties than SharePoint provides out-of-the-Box. By using the HtmlDesignerAttribute and a little bit of Javascript, we can provide web part users with a custom property builder which presents a stylish and functional interface to manage custom web part properties.

Microsoft provides us with a simple example custom property builder in the zoombldr.aspx file located below the 60 hive in C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\[LCID] where LCID equals 1033 for English - United States installations. Zoombldr.aspx is displayed by clicking the small button that appears to the right of a text property in a web part's toolpart:



If we take a look behind the scenes, we'll see that the OnClick event of the text property's button in the tool part calls out to the Javascript function MSOPGrid_doBuilder(). MSOPGrid_doBuilder() is located in the ows.js file, and looks like this (click for larger view):




As you can see, MSOPGrid_doBuilder() makes a Javascript showModalDialog() call with parameters to indicate the location of the page to be displayed, the arguments to pass to the dialog window, and settings for the dialog window's appearance.

To use our own custom builder, we start by decorating the web part custom property in question with the HtmlDesignerAttribute as shown below:


The BrowserBuildertype.Dynamic parameter of the HtmlDesignerAttribute also requires us to override the GetCustomerBuilder method of Microsoft.SharePoint.WebPartPages.WebPart in our web part class:


Inside of your custom builder page, get hold of the web part's property value by accessing the Javascript window.dialogArguments object. Subsequently, your custom builder can manipulate and ultimately return the web part's property value through the window.returnValue object. A good practice for getting and setting the values of these Javascript objects is by overriding the window.onload and window.onunload events:


Finally, here's an example of a custom property builder in action:


There seems to be very little doumentation on the HtmlDesignerAttribute, and Googling for 'HtmlDesignerAtribute' produces only a few results, of which only one or two are actually useful. There's also an interesting BuilderArguments parameter to the HtmlDesignerAttribute that I'm not even sure what does! The docs say that BuilderArguments "Contains the arguments that are passed to the custom builder" but nothing appears to be passed into the window.dialogArguments object from this parameter (any ideas?).

This article has skimmed over a lot of the details, assuming that you have some experience in developing custom web parts. For further study, I'd recommend starting off by dissecting the zoombldr.aspx file and experimenting a bit on your own. If you'd like to to learn more about developing web parts and other solutions for Windows SharePoint Service and SharePoint Portal Server 2003, please consider attending one of our developer classes.

Saturday, November 19, 2005

SharePoint Portal Area Listings Rollup and RSS Syndication Web Part



I recently took on the role of maintaining SharePoint Solutions' Resource Portal. Historically, the Resource Portal's content has primarily been in the form of Portal Area Listings. If you haven't visited our Resource Portal recently, please take a look and feel free to send me your comments. It's a work in progress, and I need some help with the artsy stuff.


From a content perspective, I wanted to give the portal a more dynamic "Blog like" look and feel, and roll-up SubArea Listings with RSS syndicated feeds. For performance reasons, I also felt it was important to have controls for caching both the displayed roll-up and the RSS Feed. Although I was able to find freely downloadable solutions that provide RSS syndication of WSS Lists, I couldn't seem to find anything for rolling-up and syndicating Portal Area Listings.


As a result, I went ahead and threw together a little web part to handle the task. An online demonstration of the Area Listings Rollup web part can be found on the home page of our Resource Portal.


The web part has four display styles: Full, Simple, Headlines, and Alphabetical Headlines. The Full style (shown top right) provides the most details, displaying links to the Portal Listing's parent Area, the Portal Listing author's My Site, and of course the listing itself. The most compact style is Headlines, displaying only links to the Portal Listings. In each of the display styles, an image linking to the Area Listing Rollup's RSS Syndicated feed is diplayed in the bottom left corner (not shown).



In addition to setting the display style, web part caching is also configurable from the tool pane, and the RSS image link can optionally be hidden from view.

That's about it. You can get the bits for the Area Listings Rollup Web Part here, or from the Downloads Area over on our Resource Portal.

We also have some public community forums at forums.sharepointsolutions.com, and for SharePoint training visit www.sharepointsolutions.com.

Monday, November 14, 2005

Developer's Tip: Render System.Diagnostics.Trace ouptut in a SharePoint WebPart Page


Viewing process and object details at runtime through trace output statements is a valuable tool for any software developer. In .NET, Trace statements are great because their publish/subscribe model allows them to be left in released code with very little impact to performance when no listeners are attached. Down the road when a problem pops up in production, an administrator can turn on the appropriate trace listener and receive debug information to help troubleshoot.

Victor Vogelpoel of Macaw has released a free SharePoint WebPart that allows SharePoint developers to use System.Diagnostics.Trace statements in only a few simple steps.

Just add the System.Diagnotics namespace to your Web Part class,


and display trace output with the Trace.WriteLine statement.

The resulting trace output will be "captured" by Macaw's TraceInfo WebPart.

That's it!

The TraceInfo WebPart also has the ability to filter based on trace category:

The TraceInfo WebPart can be downloaded from Victor's blog.

Tuesday, November 01, 2005

WSS Alert Manager v1 Released



One of the most frequently asked questions in our classes over the past three years has been related to SharePoint Alerts. Users like the Alert functionality in SharePoint but many also feel that it is too limited. They need the ability to "push" Alerts to other users and more robust Alert management tools for Sites where there are hundreds or even thousands of users.

There have been a few add-ons developed by third-parties (some as freeware, some as software) that attempt to provide more functionality but their reception has been lukewarm. In most cases this is because they are not supported or they still fall short of what is really needed.

We have just completed the development and beta testing of a SharePoint Add-on that is designed to provide robust Alert management capabilities including the ability to "push" alerts to multiple users. Our add-on has been professionally designed and developed and is professionally supported. It is not a freeware “web part” with limited functionality and no support. It is a robust, full-featured piece of software that is well-integrated with SharePoint Administration and allows WSS Site Administrators to do the following:
  • Subscribe other Site Users to SharePoint Alerts on any List, Document Library or Document in a Site
  • Add/Change/Delete Alerts for one or more users on any List, Document Library or Document in a Site
  • Manage all Alerts for a User
  • Manage all Alerts for all Users for a List
  • For Sites with large numbers of Users, quickly find a User and manage her Alerts using search technology that supports searching by Login, Preferred Name or e-mail address. The User search also supports partial words, wildcard and pattern matching
  • Quickly and efficiently Add/Change/Delete Alerts for Sites that contain hundreds of Lists and thousands of Users

The add-on sells for $500 (USD) per Web Front-End Server. Currently it is only available for the U.S. English locale, but we are working on versions for other languages and plan to release those over the next month.

We had over 100 downloads of the add-on during beta testing over the past four weeks. Many beta testers reported that they are very pleased with the high quality of the product and very few bugs were reported.

The page on our site that provides product information and a link to purchase is:

https://shop.sharepointsolutions.com/p-12-wss-alert-manager-1000.aspx

Wednesday, August 17, 2005

NASA To Begin Training on SharePoint


NASA has engaged us to conduct on-site training at the Marshall Space Flight Center in Hunstville, AL. We will head down from Nashville week after next to train a group of IT personnel.

It never ceases to amaze us how broadly SharePoint is being adopted in government agencies in the United States. Over the past two years we have had many, many students from Federal, State and Local agencies attend our classes.

The common theme we hear from the majority of these students is that their agencies have serious problems with organizing and finding important information which is currently dispersed in multitudes of systems and document stores.

They see SharePoint as a reasonably priced solution for bringing organization to the seas of information that their agencies need to navigate.

Wednesday, April 20, 2005

New Training Class For SharePoint Web Developers



Over the past two years we have noticed that there are really two types of developers that are working with SharePoint: 1) .NET Developers and 2) Web Developers. Sometimes a person falls into both categories, but more often than not a developer is either one or the other.

In general, .NET Developers focus more on customizing the functionality of SharePoint 2003 by writing custom web parts and using the object model. Web Developers, on the other hand, focus more on branding and look and feel customizations and in many cases do not have .NET programming backgrounds - they work more with HTML, CSS, Javascript, etc. We have a great 5-day class for .NET Developers, but up until now we have not had a class specifically oriented towards Web Developers.

One of our instructors, Kevin Pine, is an experienced web developer. Before SharePoint, he developed numerous commercial websites. In addition to his technical skills, he has a background as a graphic artist and professional photographer, so he is able to design very visually appealing web sites.

Now, Kevin has applied his artistic and web site design talents to SharePoint 2003. Over the past year he has been working on a new course specifically targeted to professional web developers. It is now ready to go and the first offering will be May 17 - 19 in Nashville, TN.

Read about the new course at http://www.sharepointsolutions.com/advtraining.html.

Sunday, February 13, 2005

New Version of SharePoint SDK Released


While I was out at the Office 2003 Developer Conference in Redmond, one of the Microsoft SPS team members made a point to let me know about the new version of the SharePoint SDK that was scheduled to release soon.

By the time I returned home, it had already been posted on Microsoft's download site. Download it here.

She said a lot of work has gone into this new version of the SDK, especially in the sections related to the Search engine.

Thursday, February 03, 2005

Notes From Office System Developer Conference 2005 in Redmond


This week I am attending the inaugural Office System Developer Conference at the Microsoft Conference Center in Redmond. We've completed two of the three days and from my perspective it has been extremely valuable.

Here are some of the most important things I have learned:

1. Three back-to-back sessions were conducted on customizing SharePoint in terms of branding, site definitions and list definitions. Several Microsoft developers drilled down into what could be done easily, what is more difficult and perhaps MOST important - what can be done safely without risking problems with future upgrades to the product.

2. Two Microsoft developers conducted two excellent sessions on customizing the SharePoint Portal Server Search service. In particular, they covered A) using the Search service from applications other than SharePoint and B) customizing the out-of-the-box Search features in SharePoint Portal Server and WSS. Regarding the latter, the specific customizations they demonstrated were:
  • Replacing the WSS site search box with a new search box that calls the SPS search engine and scopes the search to search the entire WSS site collection instead of just a single site
  • Enhancing the drop-down search scope menu in SPS to allow for grouping of search scopes and creating cascading menus to make the search scope list easier to use
  • How to add search scopes to the drop-down for portals other than the one the user is running the query from
  • How to allow the users to use Boolean logic in the SPS search
  • How to provide WSS List Item results in the SPS search
  • Customizing the SPS Search Results Web Part to highlight hits
  • Customizing SPS Search to allow the users to enter wildcards

3. An excellent (and very entertaining) session by Microsoft's John Durant titled "Bringing Corporate Data to Life with an Advanced Research Task Pane". The Research Services Task Pane in all of the Office 2003 applications is a feature that is not widely understood (IMHO). It is a very powerful feature that is incredibly extensible. In essence, it gives us a very easy way to bring all sorts of corporate data into the Office Task Pane and then easily insert that data into a Word document, Excel Spreadsheet, Outlook email message, etc. It can really improve end-user productivity when compared to the traditional approach of having multiple windows open, copy and pasting, etc.

4. At a lunch with one of the SharePoint Program Managers, I learned that even more emphasis will be put on SharePoint as a "development platform" in the next version (which he refers to as Version 3). This is great news for everybody (again, IMHO) and will even further distinguish SharePoint from other portal and collaboration offerings in the marketplace.

I am looking forward to the final day and then getting back and putting some of this information to use in our SharePoint training classes.