Share via


WorkbookBase.ContentTypeProperties 属性

定义

获取描述工作簿中存储的元数据的属性的集合。

public:
 property Microsoft::Office::Core::MetaProperties ^ ContentTypeProperties { Microsoft::Office::Core::MetaProperties ^ get(); };
public Microsoft.Office.Core.MetaProperties ContentTypeProperties { get; }
member this.ContentTypeProperties : Microsoft.Office.Core.MetaProperties
Public ReadOnly Property ContentTypeProperties As MetaProperties

属性值

Microsoft.Office.Core.MetaProperties 集合,其中包含描述存储在工作簿中的元数据的属性。

示例

下面的代码示例检索与当前工作簿关联的元数据。 该示例显示找到的元数据属性总数,后跟每个属性的名称和值。 若要运行此示例,必须将工作簿发布到 Microsoft Office SharePoint Server 文档库,并为此工作簿提供自定义元数据属性。 例如,可以在发布工作簿的文档库中添加列。 有关内容类型属性的详细信息,请参阅 Microsoft Office SharePoint Server 文档。

此示例适用于文档级自定义项。

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

适用于