< Back

Import-D365CeODataEntity

Mon Jan 13, 2020 8:43 am

NAME Import-D365CeODataEntity



SYNOPSIS

Import a Data Entity into Dynamics 365 Customer Engagement





SYNTAX

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

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





DESCRIPTION

Imports a Data Entity, defined as a json payload, using the OData endpoint of the Dynamics 365 Customer Engagement





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 object that you want to import into the D365CE environment



Remember that json is text based and can use either single quotes (') or double quotes (") as the text

qualifier, so you might need to escape the different quotes in your payload before passing it in



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



-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



NOTES





Tags: OData, Data, Entity, Import, Upload



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



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



PS C:\\>Import-D365CeODataEntity -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"}'



This will import a Data Entity into Dynamics 365 Customer Engagement using the OData endpoint.

The EntityName used for the import is ExchangeRates.

The Payload is a valid json string, 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"}'



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



This will import a Data Entity 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