Tag Archives: ImageWebPart

How to add an image web part / ImageWebPart part via your onet.xml or elements manifest

<AllUsersWebPart WebPartZoneID="RightZone" WebPartOrder="4">
  <![CDATA[
      <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2">
        <Title>Employee Emergency Line</Title>
        <FrameType>None</FrameType>
        <Description>Use to display pictures and photos.</Description>
        <PartImageSmall />
        <PartImageLarge>/_layouts/images/msimagel.gif</PartImageLarge>
        <Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
        <TypeName>Microsoft.SharePoint.WebPartPages.ImageWebPart</TypeName>
        <ImageLink xmlns="http://schemas.microsoft.com/WebPart/v2/Image">/SiteCollectionImages/logo.gif</ImageLink>
        <AlternativeText xmlns="http://schemas.microsoft.com/WebPart/v2/Image" />
        <VerticalAlignment xmlns="http://schemas.microsoft.com/WebPart/v2/Image">Middle</VerticalAlignment>
        <HorizontalAlignment xmlns="http://schemas.microsoft.com/WebPart/v2/Image">Center</HorizontalAlignment>
        <BackgroundColor xmlns="http://schemas.microsoft.com/WebPart/v2/Image">transparent</BackgroundColor>
      </WebPart>
   ]]>
</AllUsersWebPart>

Properties of note:

  • ImageLink
    Url to image, can be relative. Note tokens are supported in this xml element, i.e. ~SiteCollections/SiteCollectionImages/logo.gif
Advertisements
Tagged , , ,