Get-ERPEntityTypes

Cmdlet to retrieve metadata informations about EntityTypes.

Syntax

1
Get-ERPEntityTypes [[-Service] <String>] [[-EntitySet] <String>] [<CommonParameters>]

Parameters

Type

Name

Description

Optional

String

Service

Retrieve all EntityTypes from the specified service

yes

String

EntitySet

Retrieve all EntityTypes from the specified entitySet

yes

Return type

EntityType [] ← on success
empty array ← on failure. Exception/ErrorMessage can be accessed using $Error.

Remarks

When calling the Get-ERPEntityTypes without arguments the EntityTypes of all available services are returned.

Examples

In the following examples we are using public OData Services (http://services.odata.org) for demonstration purposes:

Getting all available EntityTypes

1
Get-ERPEntityTypes

Getting all EntityTypes from the specified Service “OData.svc”

1
2
$entityTypes = Get-ERPEntityTypes -Service "OData.svc"
$entityTypes #returns Products, Persons...

Getting all available EntityTypes from the EntitySet “Customers”

1
2
$entityTypes = Get-ERPEntityTypes -EntitySet "Customers"
$entityTypes[0].Name #returns Customer

Error handling: Check if an error appeared by using $? and analyze the WebRequestException to understand why the error occurred, by using $Error:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$entityTypes = Get-ERPEntityTypes -Service "SomeService"

if(-not $entityTypes){
        if($? -eq $false){
                $Error[0].Exception #Could not find any service for: 'SomeService'
        }
        else{
                Write-Host("The Service 'SomeService' does not have any EntityTypes!")
        }
}