DocumentPropertyCollectionItem Property (String) |
Namespace:
Aspose.Words.Properties
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic virtual DocumentProperty this[
string name
] { get; }
Public Overridable ReadOnly Default Property Item (
name As String
) As DocumentProperty
Get
public:
virtual property DocumentProperty^ default[String^ name] {
DocumentProperty^ get (String^ name);
}
abstract Item : DocumentProperty with get
override Item : DocumentProperty with get
Parameters
- name
- Type: SystemString
The case-insensitive name of the property to retrieve.
Property Value
Type:
DocumentProperty
RemarksReturns null if a property with the specified name is not found.
ExamplesRetrieves 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