Topic
This article explains how to use Ninja-Property-Docs-Get-Singleto retrieve the value of a specified custom field in a single document.
Environment
- NinjaOne
- Microsoft PowerShell
Description
The Ninja-Property-Docs-Get-Single cmdlet retrieves the value of a specified custom field in a single document. You can specify the field name using the -AttributeName parameter and the document using the -TemplateName parameter. The cmdlet returns the current value of the custom field in the specified single document.
Only document fields with automation read permissions can be retrieved using this cmdlet.
Syntax
Ninja-Property-Docs-Get-Single [[-TemplateName] <Object>] [[-AttributeName] <Object>][<CommonParameters>]
Example
Retrieve a Value from a Single Document
PS C:> Ninja-Property-Docs-Get-Single -TemplateName "My Example Document" -
AttributeName "exampleAttribute"
Mötley CrüeThe value of the custom field "exampleAttribute" in the single document "My Example Document" is retrieved and displayed in the output.
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: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False-TemplateName
Specify the name of the single document containing the 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 and -
TemplateName parameters accept string values representing the name of the custom field to
retrieve and the name of the single document, respectively.
Outputs
System.String[]
The cmdlet returns the value of the specified custom field in the specified single 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: