Share via


SPFeatureDefinition.GetImageAltText method

Gets a localized alternate text title for the feature image.

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

Syntax

'Declaration
Public Function GetImageAltText ( _
    culture As CultureInfo _
) As String
'Usage
Dim instance As SPFeatureDefinition
Dim culture As CultureInfo
Dim returnValue As String

returnValue = instance.GetImageAltText(culture)
public string GetImageAltText(
    CultureInfo culture
)

Parameters

Return value

Type: System.String
Returns a String that represents the alternate text from a collection of XmlNode objects. Can be Empty.

Remarks

The GetImageUrl(CultureInfo) method retrieves the image to associate with the feature.

Examples

The following example inspects the SPFeatureDefinitionCollection of server farm to find the "hello" feature and display certain properties. This feature was created with a value of "New Picture" in the property named ImageUrlAltText in the file named feature.xml file and in the CustomAction element of the elements.xml file.

SPFarm farm = SPFarm.Local.Farm;
          Console.WriteLine("Hello World from farm " + farm.Name );
          SPFeatureDefinitionCollection farmFeatures = farm.FeatureDefinitions;
          System.Globalization.CultureInfo cInfo = new System.Globalization.CultureInfo(1033);           
          Console.WriteLine(farmFeatures.Count + " is the number of farm features");
          string strImgAltTxt; // this feature has ImageUrlAltText="New Picture"
          foreach (SPFeatureDefinition f in farmFeatures) {
            if (string.Equals(f.DisplayName.ToLower(cInfo), "hello"))
            {
              Console.WriteLine("****" + f.DisplayName);
              Console.Write("    " + f.ReceiverClass + " ");
              if (f.RequireResources)
                Console.WriteLine("requires resources");
              else
                Console.WriteLine("does not require resources");
              Console.WriteLine("    Assembly " + f.ReceiverAssembly);
              Console.WriteLine("    ID " + f.Id);
              Console.WriteLine("    Name " + f.Name);
              strImgAltTxt = f.GetImageAltText(cInfo);
              if (strImgAltTxt.Length > 0)
                Console.WriteLine("    Image " + strImgAltTxt);
            }
          }
          Console.ReadLine();
        }

See also

Reference

SPFeatureDefinition class

SPFeatureDefinition members

Microsoft.SharePoint.Administration namespace

XmlAttribute

Other resources

How to: Use Resources to Set Property Values in Web Server Controls