DocumentBase.ContentTypeProperties Property

 

Gets the metadata that is stored in a document, such as author name, subject, and company.

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

public MetaProperties ContentTypeProperties { get; }

Property Value

Type: Microsoft.Office.Core.MetaProperties

A Microsoft.Office.Core.MetaProperties collection that represents the metadata that is stored in a document, such as author name, subject, and company.

The following code example retrieves the metadata that is associated with the current document. The example shows the total number of metadata properties, followed by the name and value of each property. To run this example, you must publish the document to a Microsoft Office SharePoint Server document library. For more information about content type properties, see Content Types in the Windows SharePoint Services SDK. To use this example, run it from the ThisDocument class in a document-level project.

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());
    }
}
Return to top
Show: