DocumentBase.ContentTypeProperties 屬性
取得儲存在文件中的中繼資料,例如作者名稱、主旨和公司。
命名空間: Microsoft.Office.Tools.Word
組件: Microsoft.Office.Tools.Word.v4.0.Utilities (在 Microsoft.Office.Tools.Word.v4.0.Utilities.dll 中)
語法
'宣告
Public ReadOnly Property ContentTypeProperties As MetaProperties
public MetaProperties ContentTypeProperties { get; }
屬性值
型別:Microsoft.Office.Core.MetaProperties
Microsoft.Office.Core.MetaProperties 集合,表示儲存在文件中的中繼資料,例如作者名稱、主旨和公司。
範例
下列程式碼範例會擷取與目前文件關聯的中繼資料 (Metadata)。這個範例會顯示中繼資料屬性的總數,並隨後顯示每個屬性的名稱和值。若要執行這個程式碼範例,您必須將文件發行至 Microsoft Office SharePoint Server 文件庫。如需內容類型屬性的詳細資訊,請參閱 Windows SharePoint Services SDK 中的內容類型。若要使用這個範例,請在文件層級專案中的 ThisDocument 類別執行。
Private Sub GetContentTypeProperties()
Dim props As Office.MetaProperties = Me.ContentTypeProperties
MessageBox.Show("Number of metadata properties found: " _
+ props.Count.ToString())
For Each prop As Office.MetaProperty In props
MessageBox.Show("Metadata property name: " + prop.Name _
+ vbCrLf + "Metadata property value: " _
+ prop.Value.ToString())
Next
End Sub
private void GetContentTypeProperties()
{
Office.MetaProperties props = this.ContentTypeProperties;
MessageBox.Show("Number of metadata properties found: "
+ props.Count.ToString());
foreach (Office.MetaProperty prop in props)
{
MessageBox.Show("Metadata property name: " + prop.Name
+ "\r\nMetadata property value: " + prop.Value.ToString());
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。