# Get-ERPMedia

## Syntax

Get-ERPMedia [[-EntitySet] <String>] [[-Keys] <Object>] [[-File] <String>]] [<CommonParameters>]


## Parameters

Type

Name

Description

Optional

String

EntitySet

The EntitySet name where the item is located.
It is also possible to specify additional namespaces or the whole url (e.g MaterialService/Materials, http://localhost:8080/PGS/ERP/MaterialService/Materials)

no

Hashtable / PsObject

Keys

The reference properties for the searching item

no

String

File

Path where the file should be downloaded (e.g C:\Temp\myFile.txt). In case a file with the same name already exists it will be overwritten.

no

## Return type

Bool:
$true ← on success.$false ← on failure. Exception/ErrorMessage can be accessed using $Error. If the cmdlet fails due to error responses returned by the ERP system, the$Error variable provides a WebRequestException .

## Remarks

The Cmdlet is used to download the Media Link Entries (MLEs) from the specified entity to the specified location.
In case a file with the same name already exists in the specified location it will be overwritten. Also the appropriate folder structure will be created if it doesn´t exists.

## Examples

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

Connect-Erp -Service "http://services.odata.org/V3/OData/OData.svc"

Error handling, analyze why the Media Resource could not be downloaded to the specified directory, by using $Error Connect-Erp -Service "https://services.odata.org/V3/OData/OData.svc"$result = Get-ERPMedia -EntitySet "Advertisements" -Keys @{"ID" = [Guid]"db2d2186-1c29-4d1e-88ef-a127f521b9c6"} -File "C:\Temp\AdvertismentText.txt"
if(-not $result){$Error[0].Exception #"Access to the path 'C:\Temp\AdvertismentText.txt' is denied.