ImageFieldValue Constructor (String)

Constructs a new instance of a ImageFieldValue object using an <IMG> tag in the inputHTML parameter.

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

Syntax

'Declaration
Public Sub New ( _
    inputHtml As String _
)
'Usage
Dim inputHtml As String

Dim instance As New ImageFieldValue(inputHtml)
public ImageFieldValue(
    string inputHtml
)

Parameters

  • inputHtml
    Type: System.String
    HTML string containing an <IMG> tag with a src attribute. Optionally includes other recognized attributes.

Examples

using SPListItem = Microsoft.SharePoint.SPListItem;
using ImageFieldValue = Microsoft.SharePoint.Publishing.Fields.ImageFieldValue;

namespace Microsoft.SDK.SharePointServer.Samples
{
   public static ImageFieldValue GetImageFieldValueFromHtml(string htmlMarkupForImage)
        {
            string htmlForImageFieldValue = htmlMarkupForImage;
            if (string.IsNullOrEmpty(htmlMarkupForImage))
            {
                htmlForImageFieldValue = DefaultImageFieldValueHtml;
            }

            ImageFieldValue newImageFieldValue = new ImageFieldValue(htmlForImageFieldValue);

            // The ImageUrl, AlternateText, Hyperlink and other properties will 
            // reflect any recognized properties values from the tags in the html markup

            return newImageFieldValue;
        }
    }
}

See Also

Reference

ImageFieldValue Class

ImageFieldValue Members

ImageFieldValue Overload

Microsoft.SharePoint.Publishing.Fields Namespace