# Get-ERPEntityTypes Cmdlet to retrieve metadata informations about EntityTypes. ## Syntax ```{code-block} powershell :linenos: true Get-ERPEntityTypes [[-Service] ] [[-EntitySet] ] [] ``` ## 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 () for demonstration purposes: **Getting all available EntityTypes** ```{code-block} powershell :linenos: true Get-ERPEntityTypes ``` **Getting all EntityTypes from the specified Service "OData.svc"** ```{code-block} powershell :linenos: true $entityTypes = Get-ERPEntityTypes -Service "OData.svc" $entityTypes #returns Products, Persons... ``` **Getting all available EntityTypes from the EntitySet "Customers"** ```{code-block} powershell :linenos: true $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:** ```{code-block} powershell :linenos: true $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!") } } ```