Dev Team Assemble

Evil beware!
Add to Technorati Favorites

Archive

Tag: moss 2007

One of the things I was working on today was trying to get an actual image from the library was that initially I was expecting to get a PublishingImage.  All the samples on MSDN and the ones strewn about the web refer to using the ImageFieldValue and getting it from a field in the SPListItem.  Like outlined on MSDN :

  // Retrieve the current value from an SPListItem with a
  // column of the ImageField type with the name imageFieldName
  ImageFieldValue currentFieldValue =
        listItemWithImageField[imageFieldName] as ImageFieldValue;

The problem is this only works for images that are in a list, like the PublishingRollupImage of a page that links to an image in the Site Collection Images library.  The actual images in the library are stored as documents (Referenced using SPFile) so in order utilize them I need to extract the information out and create an image tag for it...like so:

 
     ImageFieldValue imageValue = new ImageFieldValue(
          string.Format("<img src=\"{0}\" alt=\"{1}\" />",
          file.Url, file.Title == null ? string.Empty : file.Title));
 

Now that I had the ImageFieldValue it was easy to work with. I could manipulate many aspects of the image using this object and then save it for rendering using ToString(). Funny thing is for my purposes (ImageGallery xml generation) I didn't even end up needing this code after all...frustrating but a good learning experience.

Props to Phanat Chan as he did the initial development on this.

Technorati Tags: , ,

So I got this error the other day when putting together a dev site collection usign varations:

An error was encountered performing this operation. You may re-try the operation, and you may need to clean up the half-created data first before re-trying. If the problem persists, please contact your system administrator

This was actually a fairly easy fix for me.  I simply had to enable the publishing features in my site.  Which is funny...because they should have been on but I must have overlooked that.  :)

Technorati Tags: , , , ,