共用方式為


SPFeatureDefinition.GetImageAltText method

取得 feature 映像的當地語系化的替代文字標題。

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

Syntax

'宣告
Public Function GetImageAltText ( _
    culture As CultureInfo _
) As String
'用途
Dim instance As SPFeatureDefinition
Dim culture As CultureInfo
Dim returnValue As String

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

參數

傳回值

Type: System.String
會傳回String表示XmlNode物件的集合的替代文字。可以是Empty

備註

GetImageUrl(CultureInfo)方法擷取映像来關聯的功能。

Examples

下列範例會檢查SPFeatureDefinitionCollection找到"hello"功能,並顯示特定內容伺服器陣列。這項功能是以"新圖片之上"中名為ImageUrlAltText中名為feature.xml檔案的檔案和CustomAction元素的 elements.xml 檔案中之屬性的值來建立。

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();
        }

請參閱

參照

SPFeatureDefinition class

SPFeatureDefinition members

Microsoft.SharePoint.Administration namespace

XmlAttribute

其他資源

How to: 使用 Web 伺服器控制項中設定屬性值的資源