Topic
This article explains how to use Ninja-Property-Docs-Get to retrieve the value of a specified custom field in a document.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Ninja-Property-Docs-Get cmdlet retrieves the value of a specified custom field in a document. You can specify the field name using the -AttributeName parameter, the document using the -DocumentName parameter, and the document template using the -TemplateId parameter. The cmdlet returns the current value of the custom field in the specified document.
Syntax
Ninja-Property-Docs-Get [[-TemplateId] <Object>] [[-DocumentName] <Object>] [[-AttributeName]<Object>] [<CommonParameters>]
Example
Retrieve a Value from a Document
PS C:> Ninja-Property-Docs-Get -TemplateId "12345" -DocumentName "My
Example Document" -AttributeName "exampleAttribute"
Line 1
Line 3The value of the custom field "exampleAttribute" in the document "My Example Document" is retrieved and displayed in the output. In this example, the custom field contains multiple lines of text.
Parameters
-AttributeName
Specify the name of the custom field you want to retrieve from the document.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-DocumentName
Specify the name of the document containing the custom field you want to retrieve.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-TemplateId
Specify the ID of the document template containing the document and custom field you want
to retrieve.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseInputs
System.String
This cmdlet does not accept input from the pipeline. The -AttributeName , -DocumentName , and -TemplateId parameters accept string values representing the name of the custom field to retrieve, the name of the document, and the ID of the document template, respectively.
Outputs
System.String[]
The cmdlet returns the value of the specified custom field in the specified document as a
string or an array of strings if more than one line is present.
Additional Resources
For more information about asset management and custom scripting, refer to the following resources: