powergate:code_reference:commandlets:get-erpmedia

Get-ERPMedia

Cmdlet to download the attached media link of a specified entity from the ERP-System.

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

Type Name Description Optional
StringEntitySetThe 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 KeysThe reference properties for the searching itemno
StringFilePath 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 overwrittenno

Bool:
$true ← on success.
$false ← on failure with an additional property 'Error' containing the Exception/ErrorMessage.

The commandlet 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.

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

Download media from the Advertisement entity

Connect-Erp -Service "http://services.odata.org/V3/OData/OData.svc"
Get-ERPMedia -EntitySet "Advertisements" -Keys @{"ID" = [Guid]"db2d2186-1c29-4d1e-88ef-a127f521b9c6"} -File "C:\Temp\TestMedia.txt"