Enhancing SharePoint lists and libraries with image picker

fix

July 27th, 2010

If you worked with SharePoint lists and libraries you probably noticed that you have an ability to add an Image type field or a hyperlink. When you add one using SharePoint UI

…. you end up with somehting that looks like this below

which is not so user friendly, because usually content authors ,don’t know whether it is relative URL they have to specify let alone the fact that they now have to go and look for image and then go back to the page.

If you worked with SharePoint Publishing pages before, you remember how publishing pages have a notion of publishing image field that renders like this

In here you can click on the Add Image link and you will get a friendly UI to select image from the site; way better approach. So how can you have the same functionality in your regular document library.

For this I will create a copy of my out of the box document library defined here ([Drive]:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\DocumentLibrary)

then in the schema.xml of the library I will add the following field (along with other fields):

<Field ID="{2E2A32F1-1B2E-4401-9527-7482D2AD0569}"
Type="Image" Name="ThumbImage"
DisplayName="Thumbnail Image" RichText="TRUE"
RichTextMode="FullHtml"
SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="ThumbImage">
</Field>

In here, nothing much more different than deifning a regular image field. The only difference are two attributes: RichText=”TRUE” RichTextMode=”FullHtml” that will actually render appropriate UI.

Once the feature is deployed and activated – now my enhanced document libraries will contain an image picker.

In my next article – I’ll touch on how you can add this field to existing document libraries.

Enjoy!

news

Any information posted on this blog does not reflect views of respective product vendors unless explicitely stated.

featured