Blog of an overweight SharePoint addict

Wed 27 Aug 08

How to brand your WebPart solutions..

Filed under: Programming, SharePoint, Visual Studio 2005 — Reginald @ 3:05 pm

So you’ve written a nice web part solution, ready to release it onto your clients environment, but wait a minute! How do they know you wrote it for them? All you’ve got is those generic icons that microsoft provide you.

This is the situation i found myself in recently, and realised that with my change in job role comes the requirement to make sure people are aware of the things that I’ve done. To this end, I decided to make sure that the company log is displayed in the Feature Activation page and in the Web Part Catalog.

At this point, I’m going to assume that you’re aware of Features and how to wrap them up in a solution package.. if you’re not, then this might not be the best post for you to start at.. in fact I’d suggest you get a copy of Inside Microsoft Windows SharePoint Services 3.0 by Ted Pattison and Daniel Larson.

Starting at the solution level, we need to place the icon that we want to use into an area accessible by the Web part. what better place than _Layouts/Images?

If you’ve followed the recommend webpart creation guidelines, you should have a directory structure in your VS2005 project that resembles TEMPLATE\FEATURES etc etc..

now under TEMPLATE add a new directory of IMAGES and then your own directory under this e.g. CUSTOMLOGOS (This is best practice to seperate your images from Microsofts in the IMAGES directory to avoid filename conflicts.)

In this directory, place your chosen .JPG file which should be approximately 44 pixels square.

The first task is to ensure that this file is included in your .WSP package. To do this, make sure the following line is in your DDF file. (NB: this is all on one line.. but my blog isn’t wide enough to display it!)

TEMPLATE\IMAGES\CUSTOMLOGOS\custom_logo_44sq.jpg IMAGES\CUSTOMLOGOS\custom_logo_44sq.jpg

And in your manifest.xml you’ll need a corresponding entry:-

<TemplateFiles>
<TemplateFile Location="IMAGES\CUSTOMLOGOS\custom_Logo_44sq.jpg"/>
</TemplateFiles>

The section above basically just copies your chosen logo into the IMAGES and makes it available using the URL \IMAGES\CUSTOMLOGOS\custom_logo_44sq.jpg

The next step is to make this icon appear on the Feature activation page. This is very simple to achieve and just a matter of adding or amending the ImageUrl property of the Feature tag in your Feature.XML

<?xml version="1.0" encoding="utf-8" ?></code>
<Feature
  Id="00000000-0000-0000-0000-000000000000"
  Title="My custom branded web part"
  Description="This feature uses custom branding."
  Hidden="FALSE"
  Scope="Site"
  ImageUrl="BlueSource/BlueSource_Logo_43sq.jpg"
  xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
    <ElementManifest Location="elements.xml"/>
</ElementManifests>
</Feature>

And then finally we want to make the image appear in the Web part gallery. This requires a change to the webpart file itself. Inside the Properties markup, add a new property tag similar to the following:-

<property name="CatalogIconImageUrl" type="string">/_layouts/images/bluesource/bluesource_logo_43sq.jpg></property>

NB: Ensure that you don’t add any carriage returns or line feeds in the above statement. If you do, then there is a good chance that your image will only appear on either the pop up webpart catalog, or the advanced web part window, but not both. if that happens, check the line above in your .Webpart file.

And there you have it.. Deploy your solution and your icon will be visible on both the Feature activation screen and the Webpart gallery screen.

I hope this helps.

Reg.

Fri 15 Aug 08

SUGUK London Meeting.

Filed under: General, Installation, Programming, SUGUK, SharePoint — Reginald @ 8:17 am

Well last night saw what was possibly the busiest August SUGUK meeting i’ve ever seen, so much so that they ran out of Pizza!! (Nick, this is a crime that can never be repeated!!!)

Two very good sessions, the first by Eric (www.sharepointcowboy.com) Shupps (I think I spelled that right..) and the second from our very own Matt Groves of SUGUK forum fame.

Eric covered off the subject of performance in your code, with a neat display of the differences between iterating through a collection of items using a for statement, and then doing the same using the SPListItemCollection and a CAML query. I’m pleased to say that I’ve been doing the more efficient methods for sometime now, so I feel suitably pleased with myself.. The results that Eric showed on the timings for a 250 item library were quite shocking.

The second sessions from Matt Groves talked about publishing SharePoint Extranets through Microsoft’s ISA server. Now I must admit, my own experience of ISA is from many years ago with the ISA 2000 version and it wasn’t pleasant. We put it in place for a Government client that required excessive filtering of content using ISA plugins and performance and configuration was a nightmare. From what I saw of ISA last night, It looks like there have been marked improvements and Matt built a bridged SSL published application in just 22 minutes. (And this included creating the web collection!)

Out of Eric’s session, one comment he made for me caused me to prick up my ears, and that is, if you declare the SPSite object inside a using statement, and then declare the SPWeb object from that, you DON’T need to declare the SPWeb inside a using statement as the previous using statement WILL dispose of the SPWeb for you. This saved a few lines of code and possibly a little bit of performance?

Then finally out of Matt’s session, I was hoping to ask Matt about using ISA with Microsoft NLB on your webfarm. One of the problems that I’ve had with NLB in the past is the way that NLB uses the source IP as the decision maker on the load balancing. In theory if all the extranet traffic comes from a single source IP (In this case the ISA) then the load balancing won’t do anything and all traffic will go to a single host.

Once my internet connection lets me get back onto the SugUk site, I’ll post that question up in the admin section for Matt to answer..

Reg.

Tue 5 Aug 08

Infopath forms with User ID’s

Filed under: Infopath, SharePoint — Reginald @ 1:08 pm

Well day 2 in the new office and I’m please to say I’m happy with my move. I’ve not touched a single server that doesn’t have SharePoint on it and I’ve not had to deal with any PM’s frantically chasing an update on their server builds!!

What I have been involved with is a problem using InfoPath with User ID’s from SharePoint. Greg Collin’s from the InfoPathdev.com blogs wrote a guide about how to pull User ID’s into an infopath form that can then be promoted as a property to have the [Me] filter used on.

This works very nciely when the form is being opened in InfoPath, however if you browser enable the document, his method doesn’t work as the system doesn’t like the substitution of a listname for the original GUID. The Moss logs show a Forms Services Runtime error that states the GUID is in the wrong format.

I’m looking into a clean way of getting the GUID of the user list without resorting to code, and if I find it, I’ll post back here..

Edit.. Had one of those ‘That was so obvious’ moments after reading Ton Stegemans blog. You can obtain the List ID by going to People and Groups and examining the URL returned when you click on the menu options for list properties. (I want to use the word sttings but wordpress won’t let me type it! Too secure!)

Reg.

Powered by WordPress