Share via


SummaryLink.ImageUrl Property

Gets or sets the URL for the image associated with this SummaryLink object.

Namespace:  Microsoft.SharePoint.Publishing
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
Public Property ImageUrl As String
    Get
    Set
'Usage
Dim instance As SummaryLink
Dim value As String

value = instance.ImageUrl

instance.ImageUrl = value
public string ImageUrl { get; set; }

Property Value

Type: System.String
The URL for the image associated with this SummaryLink.

Exceptions

Exception Condition
ArgumentException

Invalid property value. The value cannot exceed 2047 characters.

ArgumentException

URL is not valid.

Remarks

The ImageUrl property can be empty. If the ImageUrl property contains a string that is not empty, the string must be a URL that is either server-relative or fully qualified. Server-relative URLs start with a single backslash character. A fully qualified ImageUrl must have one of the following allowed protocols:

  • http:

  • https:

  • file:

  • ftp:

  • mailto:

  • msn:

  • news:

  • nntp:

  • pnm:

  • mms:

  • outlook:

If the URL starts with "//" or "\\" it is considered to be a file: protocol and the beginning two slashes are replaced with file://. When setting the value, the input is first stripped of leading and trailing whitespace before being applied. If the absolute URL refers to an item in the current site collection, it is turned into a server-relative URL before being applied. This value is available in the XSL rendering through the @ImageUrl parameter.

Examples

// Add Groups and links.
            // The link style set here must correspond to one of the template names in the XSL Item style
            // This is not verified by the OM, but an incorrect template name results in the
            // link not rendering.
            
            // GroupA

            summaryLink = summaryLinks.Add("GroupA");
            summaryLink.IsGroupHeader = true;

            summaryLink = summaryLinks.Add("Link1");
            summaryLink.Description = "Description1";
            summaryLink.Style = "Default";
            summaryLink.ImageUrl = "http://www.live.com/live/1.100.7.337/img/wl_jewel.gif";
            summaryLink.LinkUrl = "http://www.example.com/link1";

            summaryLink = summaryLinks.Add("Link2");
            summaryLink.Description = "Description2";
            summaryLink.Style = "Default";
            summaryLink.ImageUrl = "http://www.live.com/live/1.100.7.337/img/wl_jewel.gif";
            summaryLink.LinkUrl = "http://www.example.com/link2";

            // GroupB

            summaryLink = summaryLinks.Add("GroupB");
            summaryLink.IsGroupHeader = true;

            summaryLink = summaryLinks.Add("Link3");
            summaryLink.Description = "Description3";
            summaryLink.Style = "Default";
            summaryLink.ImageUrl = "http://www.live.com/live/1.100.7.337/img/wl_jewel.gif";
            summaryLink.LinkUrl = "http://www.example.com/link3";
            summaryLink.LinkToolTip = "Tooltip for link3";

            return summaryLinkValue;

Note

This code example is part of a larger code example in the SummaryLink topic.

See Also

Reference

SummaryLink Class

SummaryLink Members

Microsoft.SharePoint.Publishing Namespace

ImageUrlAltText