A Custom PropertyDefined


For the purposes of this book, a "custom" property type is a property, other than the ten that are available out of the box, which provides a desired functionality or behavior. One example might be to provide a drop-down lookup populated from a database or web service. The specific business problem will determine the custom property you will need. Let's take a look at a couple examples.

Custom Data Lookups

One very popular modification is a data lookup. Static data could easily be kept in a list on the site and used through a lookup. The problem with lookups is that they are specific to a site and somewhat difficult to maintain. The shelf life of the data stored in the lookup will determine how often it must be updated. The higher the update frequency, the greater the maintenance involved. As a rule of thumb, when the data in a lookup needs to be refreshed many times a day, a real-time lookup is needed. Even though this process can be automated with some custom development, it would still require a significant amount of maintenance to ensure that the batch process completed at the end of each period. Now factor this out by the number of lists that are needed. It quickly becomes obvious that this can be a lot of maintenance. Retrieving data from a foreign system is a common integration problem that SharePoint doesn't address.

Let's look at an example. A database that keeps track of vendors and customers is maintained through an application that has been in service for some time. It would be really nice to just look this data up and bind a customer ID to a list item. The property of a document in a document library would hold the customer ID.

In SharePoint, there is no native way to provide these kinds of lookups. A user would have to cut and paste information into text fields, and no user would be happy about that. Happiness aside, data could be entered incorrectly and thus make the application appear to cause more harm than good. A custom property can provide the one piece of functionality that makes the whole integration happen. When your imagination starts running on data lookups in foreign systems, countless uses come to mind. Let's look at a different type of custom property.

Custom Functionality

Another way to use a custom property is to provide additional functionality. The best way to describe this idea is by example. I worked on a project for policies and procedures where the business user wanted to categorize documents using a tree control. The nodes of the tree control would group together similar policies and procedures. The basic idea was that when a user clicked a node, a list of documents would appear. The custom functionality would be akin to the way Windows Explorer works with a hierarchy of folders in the left pane and files in the right pane.

Picture a web part page with two web parts. The web part on the left would house the tree control, and the web part on the right would display the list of documents. When a user clicks a node of the tree control, a list of documents would appear on the right.

One of the properties of the document library was a tree control. When the tree control was presented to the user in any situation where the properties could be entered or modified, check boxes would appear next to each node. These check boxes could be checked or unchecked, and the value of the node would be saved.

When the user clicked a node in the tree control, the document list web part would dynamically filter list items based on the value of the node selected. This functionality gave the appearance that the documents "lived" in those nodes.

In this case, the data was fairly static. The tree control was maintained in a similar fashion as the other properties. The tree control data (such as the node information) was stored in a database so that it could be used in other systems.

This is just one example of providing functionality within the confines of SharePoint that wouldn't have been possible without a custom property.

Other Custom Property Types

Custom data lookups and custom functionality are not the only uses of a custom property, but they are the most common. Your business need might require some other kind of custom property. The problems are limited only by the creativity of the organization. Hopefully this chapter and the next will show you how to leverage a custom property to solve most of them.




SharePoint 2003 Advanced Concepts. Site Definitions, Custom Templates, and Global Customizations
SharePoint 2003 Advanced Concepts: Site Definitions, Custom Templates, and Global Customizations
ISBN: 0321336615
EAN: 2147483647
Year: 2006
Pages: 64

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net