DocumentBase.ContentTypeProperties 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取存储在文档中的元数据(如作者姓名、主题和公司)。
public Microsoft.Office.Core.MetaProperties ContentTypeProperties { get; }
属性值
一个 MetaProperties 集合,表示存储在文档中的元数据(如作者姓名、主题和公司)。
示例
下面的代码示例检索与当前文档关联的元数据。 该示例显示了元数据属性的总数,后跟每个属性的名称和值。 若要运行此示例,必须将文档发布到 Microsoft Office SharePoint Server 文档库中。 有关内容类型属性的详细信息,请参阅 Windows SharePoint Services SDK 中的内容类型。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。
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());
}
}
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