Udostępnij za pośrednictwem


WorkbookBase.ContentTypeProperties Property

Gets a collection of properties that describe metadata that is stored in the workbook.

Namespace:  Microsoft.Office.Tools.Excel
Assembly:  Microsoft.Office.Tools.Excel.v4.0.Utilities (in Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property ContentTypeProperties As MetaProperties
    Get
public MetaProperties ContentTypeProperties { get; }

Property Value

Type: Microsoft.Office.Core.MetaProperties
A Microsoft.Office.Core.MetaProperties collection that contains properties that describe metadata that is stored in the workbook.

Examples

The following code example retrieves the metadata that is associated with the current workbook. The example shows the total number of metadata properties found followed by the name and value of each property. To run this example, you must publish the workbook to a Microsoft Office SharePoint Server document library and provide a custom metadata property for this workbook. For example, you can add a column in the document library where the workbook is published. For more information about content type properties, please refer to the Microsoft Office SharePoint Server documentation.

This example is for a document-level customization.

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 Security

See Also

Reference

WorkbookBase Class

Microsoft.Office.Tools.Excel Namespace