DocumentPropertyCollectionItem Property (String)

Returns a DocumentProperty object by the name of the property.

Namespace:  Aspose.Words.Properties
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public virtual DocumentProperty this[
	string name
] { get; }

Parameters

name
Type: SystemString
The case-insensitive name of the property to retrieve.

Property Value

Type: DocumentProperty
Remarks

Returns null if a property with the specified name is not found.

Examples
Retrieves a custom document property by name.
Document doc = new Document(MyDir + "Properties.docx");

DocumentProperty docProperty = doc.CustomDocumentProperties["Authorized Date"];

if (docProperty != null)
{
    Console.WriteLine(docProperty.ToDateTime());
}
else
{
    Console.WriteLine("The document is not authorized. Authorizing...");
    doc.CustomDocumentProperties.Add("AuthorizedDate", DateTime.Now);
}
See Also