< Back

Import-D365CeODataEntityBatchMode

Mon Jan 13, 2020 8:44 am

NAME Import-D365CeODataEntityBatchMode



SYNOPSIS

Import a set of Data Entities into Dynamics 365 Customer Engagement





SYNTAX

Import-D365CeODataEntityBatchMode [-EntityName] <String> [-Payload] <String[]> [[-Tenant] <String>] [[-URL]

<String>] [[-ClientId] <String>] [[-ClientSecret] <String>] [-RawOutput] [-EnableException] [<CommonParameters>]





DESCRIPTION

Imports a set of Data Entities, defined as a json payloads, using the OData endpoint of the Dynamics 365 Customer

Engagement



The entire payload will be batched into a single request against the OData endpoint





PARAMETERS

-EntityName <String>

Name of the Data Entity you want to work against



The parameter is Case Sensitive, because the OData endpoint in D365CE is Case Sensitive



Remember that most Data Entities in a D365CE environment is named by its singular name, but most be retrieve

using the plural name



E.g. The account Data Entity is named "account", but can only be retrieving using "accounts"



Use the XRMToolBox (https://www.xrmtoolbox.com) to help you identify the names of the Data Entities that you

are looking for



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Payload <String[]>

The entire string contain the json objects that you want to import into the D365CE environment



Payload supports multiple json objects, that needs to be batched together



Required? true

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Tenant <String>

Azure Active Directory (AAD) tenant id (Guid) that the D365CE environment is connected to, that you want to

access through OData



Required? false

Position? 3

Default value $Script:ODataTenant

Accept pipeline input? false

Accept wildcard characters? false



-URL <String>

URL / URI for the D365CE environment you want to access through OData



Required? false

Position? 4

Default value $Script:ODataUrl

Accept pipeline input? false

Accept wildcard characters? false



-ClientId <String>

The ClientId obtained from the Azure Portal when you created a Registered Application



Required? false

Position? 5

Default value $Script:ODataClientId

Accept pipeline input? false

Accept wildcard characters? false



-ClientSecret <String>

The ClientSecret obtained from the Azure Portal when you created a Registered Application



Required? false

Position? 6

Default value $Script:ODataClientSecret

Accept pipeline input? false

Accept wildcard characters? false



-RawOutput [<SwitchParameter>]

Instructs the cmdlet to output the raw json string directly



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-EnableException [<SwitchParameter>]

This parameters disables user-friendly warnings and enables the throwing of exceptions

This is less user friendly, but allows catching exceptions in calling scripts



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.String





NOTES





Tags: OData, Data, Entity, Import, Upload



Author: M????tz Jensen (@Splaxi)



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Import-D365CeODataEntityBatchMode -EntityName "ExchangeRates" -Payload '{"@odata.type"

:"Microsoft.Dynamics.DataEntities.ExchangeRate", "RateTypeName": "TEST", "FromCurrency": "DKK", "ToCurrency":

"EUR", "StartDate": "2019-01-03T00:00:00Z", "Rate": 745.10, "ConversionFactor": "Hundred", "RateTypeDescription":

"TEST"}','{"@odata.type" :"Microsoft.Dynamics.DataEntities.ExchangeRate", "RateTypeName": "TEST", "FromCurrency":

"DKK", "ToCurrency": "EUR", "StartDate": "2019-01-04T00:00:00Z", "Rate": 745.10, "ConversionFactor": "Hundred",

"RateTypeDescription": "TEST"}'



This will import a set of Data Entities into Dynamics 365 Customer Engagement using the OData endpoint.

The EntityName used for the import is ExchangeRates.

The Payload is an array containing valid json strings, each containing all the needed properties.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>$Payload = '{"@odata.type" :"Microsoft.Dynamics.DataEntities.ExchangeRate", "RateTypeName": "TEST",

"FromCurrency": "DKK", "ToCurrency": "EUR", "StartDate": "2019-01-03T00:00:00Z", "Rate": 745.10,

"ConversionFactor": "Hundred", "RateTypeDescription": "TEST"}','{"@odata.type"

:"Microsoft.Dynamics.DataEntities.ExchangeRate", "RateTypeName": "TEST", "FromCurrency": "DKK", "ToCurrency":

"EUR", "StartDate": "2019-01-04T00:00:00Z", "Rate": 745.10, "ConversionFactor": "Hundred", "RateTypeDescription":

"TEST"}'



PS C:\\> Import-D365CeODataEntityBatchMode -EntityName "ExchangeRates" -Payload $Payload



This will import a set of Data Entities into Dynamics 365 Customer Engagement using the OData endpoint.

First the desired json data is put into the $Payload variable.

The EntityName used for the import is ExchangeRates.

The $Payload variable is passed to the cmdlet.











RELATED LINKS

Add-D365CeODataConfig

Get-D365CeActiveODataConfig

Set-D365CeActiveODataConfig