Dynamics 365 finance for operation Integration development - Song Nghia - Microsoft Dynamics Partner

Song Nghia - Microsoft Dynamics Partner

Song Nghia - Microsoft Dynamics Partner

Breaking

Saturday, December 5, 2020

Dynamics 365 finance for operation Integration development


Dynamics 365 finance for operation
Integration development

Thanks anh An.Bui

Nghia Song -  Microsoft Dynamics 365 Technical Consultant

Nghia Song

Tel - WhatsApp: +84967324794

Email: songnghia.uit@gmail.com

Contents

I. Prepare (Configuration) for 3rd Project to integrate with D365 FO: 3

II. Prepare (Odata Client Schema) or 3rd Project to integrate with D365 FO 10

III. Sample OdataConsoleApplication 14

IV. Sample customize SOAP Service to check Item On-hand 15

V. Sample Bring your own database (BYOD) 30


D365 FO:

Topic

Register application in Azure

 

Step

Screenshot

Description

1

Microsoft Azure 
Select 
subscription 
p Search resources, serrices, and docs (G+/) 
Azure services 
Create a 
resource 
Azure Active 
DI rectory 
Virtual 
machines 
MPN 
Resource groups 
Subscriptions 
SQL databases 
Subscription 
Virtual machine 
All resources 
App Services 
Storage 
accounts 
Dashboard 
Azure Database 
for PostgreSQL 
LAST VIEWED 
3 h ago 
2 d ego 
More services 
Recent resources 
NAME 
Visual Studio Enterprise — 
devalOd3bf50b-1 
Navigate 
Subscriptions 
Tools 
Microsoft Learn 
Learn Azure with free online 
training from Microsoft 
Azure Monitor 
Monitor your apps and 
infrastructure 
Security Center 
Secure your apps and 
infrastructure 
Cost Management 
Analyze end optimize your 
cloud spend for free

 

Registration App ID in Azure

Go to: https://portal.azure.com/

Login with your email account

2

Microsoft Azure 
Select 
subscription 
p Search resources, serrices, and docs (G+/) 
Azure services 
Create a 
resource 
Azure Active 
DI rectory 
Virtual 
machines 
MPN 
Resource groups 
Subscriptions 
SQL databases 
Subscription 
Virtual machine 
All resources 
App Services 
Storage 
accounts 
Dashboard 
Azure Database 
for PostgreSQL 
LAST VIEWED 
3 h ago 
2 d ego 
More services 
Recent resources 
NAME 
Visual Studio Enterprise — 
devalOd3bf50b-1 
Navigate 
Subscriptions 
Tools 
Microsoft Learn 
Learn Azure with free online 
training from Microsoft 
Azure Monitor 
Monitor your apps and 
infrastructure 
Security Center 
Secure your apps and 
infrastructure 
Cost Management 
Analyze end optimize your 
cloud spend for free

 

Select your subscription

3

Microsoft Azure 
Home > Visual Studio Enterprise— MPN 
C Visual Studio Enterprise — MPN 
Su 
Manage Cancel subscription Rename Change directol 
Search (Ctrl 
You have 512543 credits remaining. Click here to remue )mur spending lim- 
@ Overview 
subscription ID : G0620de-87eg-4cd5-90b7-1e1a7313f223 
Activity log 
Access control (IAM) 
Diagnose and solve problems 
Security 
Events 
Cost Management 
Cost analysis 
Budgets 
Advisor recommendations 
Billing 
Invoices 
External services 
p Azure active 
Services 
Azure Active Directory 
Activity log 
Azure Cosmos 03 
Azure Database for MySQL servers 
Azure AD Identity Protection 
2 
Azure AD Identity Secure Score 
Azure Arc 
Azure Databricks 
CJ Azure Devops 
Azure Lighthouse 
Resources 
No results were found. 
All 41 results 
Directory 
My role 
Offer 
Offer ID 
Costs 
: Votive (votivasoft.com) 
: Account admin 
: MSDN 
: MS-AZR-0029P 
Ma rketplace 
Azure 
Azure 
Documentat 
Overview of 
What is Azu 
Overview of 
Compare Ac 
Resource Gr 
Costs by resource 
19.98USD 
2.09

 

Find Azure Active Directory

4

Microsoft Azure 
Home > Votiva - App registrations 
Votiva - App registrations 
Active 
Search (Ctrl 
O Overview 
Getting started 
Diagnose and solve problems 
Manage 
users 
Groups 
Orgenizetionel reletionships 
Roles end administrators 
Enterprise applications 
vices 
App registrations 
overnence 
p Search resources, serrices, and docs (G+, 
New registration Endpoints Troubleshooting Got feedback? 
Welcome to the new and improved App registrations (now Generally Available). See what's new 
Looking to learn how it's changed from App registrations (Legacy)? 
Still want to use App registrations (Legacy)? Go back and tell us why 
All applications Owned applications 
p Start typing e name or Application ID to filter these results 
Display name 
An3uiRD01

 

 

5

Microsoft Azure 
Home > Votiva - App registrations > Register an application 
Register an application 
* Name 
The user-facing display name for this application (this can be changed later). 
NameOfAppIication 
Supported account types 
Who can use this application or access this API? 
• Accounts in this organizational directory only (Votiva only - Single tenant) 
C) Accounts in any organizational directory (Any Azure AD directory - Multitenant) 
p Search resources, services, and docs (G +1') 
>_ 
O 
Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, XBox) 
Help me choose... 
Redirect URI (optional) 
We'll return the authentication response to this URI after successfully authenticating the user. Providing this now is optional and it can be 
changed later, but a value is required for most authentication scenarios. 
Web 
By proceeding, y 
Register 
e.g. https://myapp.com/auth 
ree to the Microsoft Platform Policies

 

Input name of your application

6

Microsoft Azure 
Home > Votiva - App registrations 
An Bui R DOI 
p earch (Ctrl +1) 
Overview 
Quickstart 
Manage 
Search resources, services, and docs (G +1') 
> 
AnBuiRD01 
>_ 
My organization only 
. 1 web, O public client 
an.bui@votivasoft.com 
Delete Endpoints 
O 
Got a second? We would love your feedback on Microsoft identity platform (previously Azure AD for developer). 
Display name 
Application (client) ID 
Directory (tenant) ID 
Object ID 
. AnauiRD01 
: 355730f9-b6f9-4a81-9e26-be78250d2b8b 
: c82c348b-64ef-4a07-bfa7-62fc88bc1517 
: 875189e3-79ao-4f16-9eb8-c1b685bd502a 
Supported account types 
Redirect URIS 
Application ID URI 
Managed application in 
https://votivasoft.com/9fd6bab3-e33a-4dca-bdc7-91 eeea3a2e2c 
AnauiRD01 
Branding 
Authentication 
Certificates & secrets 
API permissions 
Expose an API 
Owners 
Roles and administrators (Previ... 
Manifest 
Support + Troubleshooting 
Troubleshooting 
a New support request 
Welcome to the new and improved App registrations. Looking to learn how it's changed from App registrations (Legacy)? Learn more 
call 
APIs 
Documentation 
Microsoft identity platform 
Authentication scenarios 
Authentication libraries 
Code samples 
Microsoft Graph 
Glossary 
Help and Support 
Build more powerful apps with rich user and business data 
from Microsoft services and your own company's data 
sources. 
View API permissions 
Sign in users in 5 minutes 
@OOOO O O O

 

Remember Application (Client) Id and Directory (Tenant) Id

7

Microsoft Azure 
Home > Votiva - App registrations > An3uiRD01 
p Search resources, serrices, and docs (G+/) 
AnBuiRD01 
Search (Ctrl 
Overview 
Quickstart 
Manage 
Branding 
Authentication 
Certificates & secrets 
API permissions 
Expose an API 
Owners 
Roles end administrators (Previ... 
Manifest 
Support + Troubleshooting 
Delete Endpoints 
O 
Got second? We would love your feedback on Microsoft identity platform (previously Azure AD for developer). —9 
Display name 
: An3uiRD01 
Application (client) ID : 
355730fg-b6fg-4e81-ge26-be78250d2b8b 
Directory (tenant) ID 
: c82c348b-64ef-4e07-bfa7-62fc88bc1517 
Object ID 
: 875189e3-7geo-4f16-geb8-c1b685bd502a 
Supported account types 
Redirect URIS 
Application ID LIRI 
Managed application in 
My organization only 
1 web, O public client 
https://vcti 
.com/@fd6bab3-e. 
. An3uiRD01 
Welcome to the new and improved App registrations. Looking to learn how ts changed from App registrations (Legacy)? Learn more 
Call APIs 
Build more oowerful eoos with rich user and business data 
Documentation 
Microsoft identity platform 
Authentication scenarios 
Authentication libraries 
Code samples 
Microsoft Graph 
Glossary 
Help and Support

 

Click hyperlink Redirect URL

8

Microsoft Azure 
Home > Votiva - App registrations > AnBuiRD01 
AnBuiRD01 - Authentication 
Search resources, services, and docs (G +1') 
- Authentication 
>_ 
https://dynamicsURL/data 
an.bui@votivasoft.com 
p Search (Ctrl +7) 
Overview 
Quickstart 
Manage 
Branding 
Authentication 
Certificates & secrets 
API permissions 
Expose an API 
Owners 
Roles and administrators (Previ... 
Manifest 
Support + Troubleshooting 
Troubleshooting 
a New support request 
e] Save X Discard 
Redirect URIS 
Try out the new experience 
C) Got feedback? 
The URIS that we will accept as destinations when returning authentication responses (tokens) after s 
ly URLs. 
tnor_s _a>put r$iyect UNIS 
Type 
Web 
Web 
Redirect URI 
https://rd0111796afae4e7df37devaos.cIoudax.dynamics.com/data 
e.g. https://myapp.com/auth 
Suggested Redirect URIS for public clients (mobile, desktop) 
If you are using the Microsoft Authentication Library (MSAL) or the Active Directory Authentication Library (ADAL) to build applications for 
desktop or mobile devices, you may select from the suggested Redirect URIS below or enter a custom redirect URI above. For more 
information, refer to the library documentation. 
msa1355730f9-b6f9-4a81-9e26-be78250d2b8b://auth (MSAL only) 
https://login.microsoftonline.com/common/oauth2/nativeclient 
https://login.live.com/oauth20_desktop.srf (LiveSDK) 
Advanced settinqs

 

Input your Dynamics 365FO URL + "/data"

9

Microsoft Azure 
Home > Votiva - App registrations > An3uiRD01 - Certificates & secrets 
AnBuiRD01 - Certificates & secrets 
p Search resources, serrices, and docs 
Search (Ctrl 
Overview 
Quickstart 
Manage 
Branding 
Authentication 
Certificates & secrets 
-+ API permissions 
O Expose an API 
Owners 
Roles end administrators (Previ... 
Manifest 
Support + Troubleshooting 
Troubleshooting 
a New support request 
Add a client secret 
Description 
Test 
Expires 
O In 1 year 
O In 2 years 
• Never: 
Cancel 
A secret string that the application uses to prove its identity when requesting a token. Also can be referred to es appl 
New client secret 
Description 
RD01CIientsecretKey 
Expires 
12/31/22" 
Value

 

Create client secret key

10

Microsoft Azure 
Hame > Votive - App registrations > An3uiRD01 - Certificates & secrets 
AnBuiRD01 - Certificates & secrets 
p Search resources, serrices, and docs (G+/) 
Search (Ctrl 
Overview 
Quickstart 
Manage 
Branding 
Authentication 
Certificates & secrets 
API permissions 
Expose an API 
Owners 
Roles end administrators (Previ... 
Manifest 
Support + Troubleshooting 
Troubleshooting 
a New support request 
O 
Copy the new client secret value. Yu won't be able to retrieve it after you perform another operation or leave this blade. 
Credentials enable applications to identify themselves to the authentication service when receiving tokens et a web addressable location (using an HTTPS scheme). 
higher level of assurance, we recommend using e certificate (instead of e client secret) es a credential. 
Certificates 
Certificates can be used as secrets to prove the application's identity when requesting a token. Also can be referred to as public keys. 
Upload certificate 
No certificates have been added for this application. 
Thumbprint 
Client secrets 
Start Date 
A secret string that the application uses to prove its identity when requesting a token. Also can be referre 
New client secret 
Description 
RD01CIientsecretKey 
Expires 
Copy to 
notepad 
Expires 
12/31/22" 
12/31/2299 
Value

 

Copy Client secret key

11

Microsoft Azure 
Home > Votiva - App registrations > An3uiRD01 
O.- AnBuiRD01 - API permissions 
Search resources, sernces, and docs (G+/) 
Q 
O 
an.bui@votivasoft.com 
- API permissions 
Search (Ctrl 
Overview 
Quickstart 
Manage 
Branding 
Authentication 
Certificates & secrets 
API permissions 
Expose an API 
Owners 
Roles end administrators (Previ... 
Manifest 
Support + Troubleshooting 
Troubleshooting 
New support request 
CD Refresh 
Configured permissions 
Applications are authorized to cell APIs when they are granted permissions by users/admins as pert of the consent process. 1 
ell the permissions the application needs. Learn more about permissions and consent 
Request API permissions 
Select an API 
Microsoft APIs APIs my organization uses 
Commonly used Microsoft APIs 
Microsoft Graph 
My APIs 
Add a permission 
Grant admin consent for Votiva 
Take advantage of the tremendus amount of data in Office 365, Enterprise Mobility 
Security, and Windows 10. Access Azure AD, Excel, Intune, OutLook/Exchange, OneDrive, 
OneNote, SharePoint, Planner, and more through a single endpoint. 
API / Permissions name 
v Azure Active Directory Graph (I) 
User.Read 
Type 
Delegated 
Description 
Sign in and read user profile 
Admin Cons 
Azure Data Catalog 
Programmatic access to Data Catalog 
resources to register, annotate and 
search data assets 
Azure Key Vault 
Manage your key vaults as well as the 
keys, secrets, and certificates within your 
Key Vaults 
Azure Storage 
Secure massively scalable object and 
data lake storage for unstructured and 
semi-structured data 
Dynamics CRM 
Access the capabilities of CRM business 
software and ERP systems 
Azure Data Lake 
Access to storage and compute for big 
data analytic scenarios 
Azure Rights Management 
Services 
Allow validated users to read and write 
protected content 
Data Export Service for 
Microsoft Dynamics 365 
Export data from Microsoft Dynamics 
CRM organization to an external 
destination 
Dynamics ERP 
Programmatic access to Dynamics ERP 
Office 365 Management APIs 
Integrate with Azure DevOps and Azure 
DevOps server 
Azure Service Management 
Programmatic access to much of the 
functionality available through the Azure 
portal 
Dynamics 365 Business Central 
Programmatic access to data and 
functionality in Dynamics 365 Business 
Central 
Flow Service 
Embed flow templates and manage flows

 

Set API permission

12

Microsoft Azure 
Home > Votive - App registrations > An3uiRD01 
O.- AnBuiRD01 - API permissions 
Search resources, sernces, and docs (G+/) 
- API permissions 
Search (Ctrl 
Overview 
Quickstart 
Manage 
Branding 
Authentication 
CD Refresh 
Configured permissions 
Applications are authorized to cell APIs when they are granted permissions by users/admins as pert of the consent process. 1 
ell the permissions the application needs. Learn more about permissions and consent 
Request API permissions 
< All APIs 
Dynamics ERP 
https://erp.dynamics.com/ 
Delegated permissions 
Docs 
Your application needs to access the API as the signed-in user. 
Application permissions 
Your application runs as background service or daemon without 
signed-in user. 
Add a permission 
API / Permissions name 
Grant admin consent for Votiva 
Type 
Description 
Sign in and read user profile 
Admin Cons 
Certificates & secrets 
v Azure Active Directory Graph (I) 
API permissions 
User.Read 
Expose an API 
Owners 
Roles end administrators (Previ... 
Manifest 
Support + Troubleshooting 
Troubleshooting 
New support request 
Delegated

 

Select Delegate permission

13

Request API permissions 
< All APIs 
Dynamics ERP 
https://erp.dynemics.com/ Docs 
What type of permissions does your application require? 
Delegated permissions 
Your application needs to access the API as the signed-in user. 
Select permissions 
Type to search 
Permission 
v AX (1) 
u ccess 
Access Dynamics AX online as organization users C) 
v CustomService (1) 
CustomService.FullAccess 
Access Dynamics AX Custom Service O 
vOdata (1) 
Odete.FuIlAccess 
Access Dynamics AX data C) 
x 
Application permissions 
Your application runs as background service or daemon without 
signed-in user. 
expand all 
Admin Consent Required

 

Select permission

Topic

Clone and Test with Dynamics D365 FO Integration sample code from Microsoft github 

 

14

github.com/microsoft/Dynamics-ÆX-lntegration 
hy GitHub? 
Enterprise Explore 
microsoft / Dynamics-AX-lntegration 
Q) Issues 55 
O Code 
Pull requests 4 
Marketplace 
Projects O 
Pricing 
Wiki 
Search 
@ Watch 
bJL Insights 
Sign in 
170 
Sign up 
111 
233 
Security 
Star 
Find file 
Fork 
Join GitHub today 
GitHub is home to over 40 million developers working together to host and 
review code, manage projects, and build software together. 
Dynamics AX Integration samples and demos. 
47 commits 
V 4 branches 
Sign up 
o packages 
O O releases 
Branch: master 
New pull request 
Dismiss 
10 contributors 
Clone or download • 
bhaarathms Merge pull request from Microsoft/FixAmbiguousTypeBindingError 
Latest commit be87233 on May 26, 2018

 

https://github.com/microsoft/Dynamics-AX-Integration

15

ThisPC SAMSUNG 512G8SSD 
Name 
AuthenticationUtiIit,' 
JsonConsoIeAppIication 
ODataConsoIeAppIication 
ODataUtiIit,' 
packages 
PHPConsoIeAppIication 
ServiceTests 
SoapConsoIeAppIication 
SoapUtiIit,' 
Test Results 
TLSConsoIeA lication 
ServiceSampIes.sIn 
Dynamics-AX- Integration-master ServiceSampIes 
Date modified 
11/24/2019 8:05 PM 
12/8/2019 11:51 AM 
12/8/2019 11:57 AM 
12/8/2019 11:07 AM 
12/8/2019 11:19 AM 
12/8/2019 12:21 AM 
11/24/2019 8:05 PM 
11/24/2019 8:05 PM 
12/8/2019 5:51 PM 
12/8/20194:i8 PM 
11/24/2019 8:16 PM 
11/24/20198:D6 PM 
5/26/2018421 AM 
Type 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
Visual Studio Solu... 
Size

 

Open solution ServiceSamples.sln

16

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
Debug 
Tools Test 
Any CPU 
Analyze Window Help 
SoapConsoIeAppIication 
MetadataDocumentVaIidator.cs 
Start • 
App.config 
Program.cs 
ClientCcnfiguraticn.cs 
Default 
SoapHeIper.cs 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
m program.cs* 
Program.cs 
ODataChangesetsExampIe.cs 
x 
@AuthenticationUtiIity 
using System. Text; 
using System. Threading. Tasks; 
[S namespace Authenticationutility 
24 
AuthenticationUtiIlty.CIientConfiguration 
13 
19 
- 
8, 
public partial class 
ClientConfiguration 
IS 
public static ClientConfiguration 
Default { get { return 
ClientConfiguration . Oneaox; 
public static ClientConfiguration Oneaox = new ClientConfiguration() 
// You only need to populate this section if you are logging on via a native app. 
principal you don 't need that. 
LlriString 
"https : / / rdß111796afae4e7df37devaos . cloudax. dynamics . com/", 
"an.bui@votivasoft.com", 
Username 
// Insert the correct password here for the actual test. 
as sword 
For 
Service 
to 
Service 
scenarios 
which 
you 
use 
a service -e 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
@ ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
@ SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
@ AuthenticationUtiIity 
c' ClientConfiguration.cs 
per.cs 
packages.config 
ODataUtiIity 
SoapUtiIity 
ServiceTests 
// You need this only if you logon via service principal using a client secret. See: https://docs.microsoft.com/en-us/dynamics365/unified- 
operations / dev- itpro/ data -entities / services - home- page 
to get more data on how to populate those fields. 
// You can find that under in the azure portal 
ActiveDirectoyResource = "https://rdß111796afae4e7df37devaos.cIoudax.dynamics.com", 
handles that issue. 
ActiveDirectoyTenant = 
"https://loxin.windows.net/votivasoft.com", // Scme samples: 
https://login.windows.net/microsoft.com 
ActiveDirectoyCIientAppId 
"35573øf9-b6f9-4a81-9e26-be7825ød2b8b" , 
// Insert here the application secret when authenticate with by the application 
ActiveDirectoyCIientAppSecret — 
// Don 't have a trailing "/" . Note: Some of the sampl 
https://login.windows.net/yourtenant.onmicrosoft.com, 
code

 

Change client configuration with your app id and your D365 FO

 

Project: AuthenticationUtility

Class: ClientConfigration.cs

17

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
Debug 
Tools Test 
Any CPU 
Analyze Window Help 
SoapConsoIeAppIication 
MetadataDocumentVaIidator.cs 
ClientConfiguration.cs 
Default 
x 
SoapHeIper.cs 
AuthenticationUtiIlty.CIientConfiguration 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
m program.cs* 
Program.cs 
ODataChangesetsExampIe.cs 
Start • 
App.config 
Program.cs 
@AuthenticationUtiIlty 
using System. Text; 
using System. Threading. Tasks; 
[S namespace Authenticationutility 
24 references 
public partial class 
ClientConfiguration 
IS 
public static ClientConfiguration 
Default { get { return 
ClientConfiguration . Oneaox; 
public static ClientConfiguration Oneaox = new ClientConfiguration() 
// You only need to populate this section if you are logging on via a native app. 
13 
19 
- 
8, 
For Service to Service 
Microsoft Azure 
scenarios 
which 
you 
use 
a service -e 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
Properties 
References 
P Search resources, services, and dc 
principal you don 't need that. 
LlriString 
"https : / / rdß111796afae4e7df37devaos . cloudax. dynamics . com/", 
"an.bui@votivasoft.com", 
Username 
// Insert the correct password here for the actual test. 
assword 
// You need this only if you logon via service principal using a client se• 
operation s / dev- itpro/ data -entities / services - home- page 
to get more data 01 
// You can find that under CAD in the azure portal 
ActiveDirectoyResource = "https://rdß111796afae4e7df37devaos.cloudax.dynal 
handles that issue. 
ActiveDirectoyTenant = 
"https://loxin.windows.net/votivasoft.com", // Sorn' 
https://login.windows.net/microsoft.com 
ActiveDirectoyCIientAppId 
"35573øf9-b6f9-4a81-9e26-be7825ød2b8b" , 
Active DirectoyCIientAppSecret 
// Change TLS version of HTTP request from the client here 
// Ex: TLSVersion - 
// Leave it empty if want to use the default version 
TLSVersion = 
Home 
> Votiva - App registrations > An3uiRD01 - Certificates & secrets 
AnBuiRD01 - Certificates & secrets 
Search (Ctrl +0 
Overview 
Quickstart 
Branding 
Certificates & secrets 
API permissions 
Expose an API 
r, Owners 
Roles and administrators (Previ... 
Manifest 
Support + Troubleshooting 
Credentials enable applications to identify themselves to the authentication service when receiving tokens at wel 
higher level Of assurance we recommend using a certificate (instead Of client secret) as a credential. 
Certificates 
Certificates can be used as secrets to prove the application's identity when requesting a token. Also can be referre 
Upload certificate 
No certificates have been added for this application. 
Thumbp 
Client secrets 
Start Date 
A secret string that the application uses to prove its identity when reque 
+ New client secret 
Description 
RD01ClientsecretKey 
Also can be referred to as al 
Value 
Expires 
12/31/2299

 

Update ActiveDirectoryClientAppSecret (get from Azure)

18

ServiceSampIes 
File Edit View 
Program.cs* 
- Microsoft Visual Studio 
Project Build Debug Team Tools Test Analyze Window Help 
Program.cs 
ClientCcnfiguraticn.cs 
Default 
x 
SoapHeIper.cs 
you 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
Program.cs 
O DataChangesetsExampIe.cs 
Metadata Doc u me ntVa Iidato r 
App.config 
@AuthenticationUtiIit,' 
using System. Text; 
using System. Threading. Tasks; 
[S namespace Authenticationutility 
24 references 
public partial class 
ClientConfiguration 
AuthenticationUtiIlty.CIientConfiguration 
Ending with 
13 
19 
- 
8, 
public static ClientConfiguration 
Default { get { return 
ClientConfiguration . Oneaox; 
public static ClientConfiguration Oneaox = new ClientConfiguration() 
// You only need to populate this section if you are logging on via a native 
Service 
to 
Ending 
without / 
Icrosoft.com/en-us/d 
ose fields. 
have a trailing "/" . Note: 
use 
a service -e 
LlriString = 
ser-Name 
"https://rdZ111796afae4e7df37devacs.cloudax.dynamics.com/" 
Ivas 
// Insert the correct password here for the actual test. 
assword 
// You need this only if you logon via service principal using a client secret. See: htt 
operation s / dev- itpro/ data -entities / services - home- page 
to get more data on how to popu 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapCorwoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ Authentication Utility 
Properties 
References 
c* ClientConfiguratio 
c* OAuthHeIper.cs 
packages.config 
ODataUtiIit,' 
@ SoapUtiIit,' 
ServiceTests 
namics365/unified- 
Some of the sample code 
ActiveDirectoyResource = 
"https://rde111796afae4e7df37devacs.cloudax.dynamics.com", 
ActiveDirectoyTena nt 
"https://login.windows.net/votivasoft.com", // Some samples: 
https://login.windows.net/microsoft.com 
ActiveDirectoyCIientAppId 
"35573øf9-b6f9-4a81-9e26-be7825ød2b8b" , 
// Insert here the application secret when authenticate with by the application 
ActiveDirectoyCIientAppSecret — 
// Change TLS version of HTTP request from the client here 
// Ex: TLSVersion - 
// Leave it empty if want to use the default version 
TLSVersion = 
// Don't 
https://login.windows.net/yourtenant.onmicrosoft.com,

 

Update your D365 FO URL

19

ServiceSampIes 
File Edit View 
Program.cs* 
- Microsoft Visual Studio 
Project Build Debug Team Tools Test Analyze Window Help 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
Program.cs 
O DataChangesetsExampIe.cs 
Metadata Doc u me ntVa Iidato r 
App.config 
Program.cs 
ClientCcnfiguraticn.cs 
Default 
x 
SoapHeIper.cs 
@AuthenticationUtiIit,' 
using System. Text; 
using System. Threading. Tasks; 
[S namespace Authenticationutility 
24 reference 
public partial class 
ClientConfiguration 
AuthenticationUtiIlty.CIientConfiguration 
13 
19 
- 
8, 
public static ClientConfiguration 
Default { get { return 
ClientConfiguration . Oneaox; 
public static ClientConfiguration Oneaox = new ClientConfiguration() 
// You only need to populate this section if you are logging on via a native app. 
principal you don 't need that. 
LlriString 
"https : / / rdß111796afae4e7df37devaos . cloudax. dynamics . com/", 
"an.bui@votivasoft.com", 
Username 
// Insert the correct password here for the actual test. 
assword 
For 
Service 
to 
Service 
scenarios 
which 
you 
use 
a service -e 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapCorwoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ Authentication Utility 
Properties 
References 
c* ClientConfiguratio 
c* OAuthHeIper.cs 
packages.config 
ODataUtiIit,' 
@ SoapUtiIit,' 
ServiceTests 
// You need this only if you logon via service principal using a client secret. See: https://docs.microsoft.com/en-us/dynamics365/unified- 
operation s / dev- itpro/ data -entities / services - home- page 
to get more data on how to populate those fields. 
// You can find that under CAD in the azure portal 
ActiveDirectoyResource = "https://rdß111796afae4e7df37devaos.cIoudax.dynamics.com", 
ActiveDirectcyTenant 
"https : / / la—in .Nindcws . net/vctivascft . com", 
/ Some samples: 
ActiveDirectoyCIientAppId 
"35573af9-b6f9-4a81-9e26-be7825ad2b8b", 
// Insert here the application secret when authenticate with by the application 
ActiveDirectoyCIientAppSecret — 
// Change TLS version of HTTP request from the client here 
// Ex: TLSVersion - 
// Leave it empty if want to use the default version 
TLSVersion = 
// Don 't have a trailing "/" . Note: Some of the sample code 
https://login.windows.net/yourtenant.onmicrosoft.com,

 

Update your tenant name after : https://login.windows.net/………

20

ServiceSampIes 
File Edit View 
Program.cs* 
- Microsoft Visual Studio 
Project Build Debug Team Tools Test Analyze Window Help 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
Program.cs 
O DataChangesetsExampIe.cs 
Metadata Doc u me ntVa Iidato r 
App.config 
Program.cs 
ClientCcnfiguraticn.cs 
Default 
x 
SoapHeIper.cs 
@AuthenticationUtiIit,' 
using System. Text; 
using System. Threading. Tasks; 
[S namespace Authenticationutility 
24 references 
public partial class 
ClientConfiguration 
AuthenticationUtiIlty.CIientConfiguration 
13 
19 
- 
8, 
public static ClientConfiguration 
Default { get { return 
ClientConfiguration . Oneaox; 
public static ClientConfiguration Oneaox = new ClientConfiguration() 
// You only need to populate this section if you are logging on via a native app. 
principal you don 't need that. 
LlriString 
"https : / / rdß111796afae4e7df37devaos . cloudax. dynamics . com/", 
"an.bui@votivasoft.com", 
Username 
// Insert the correct password here for the actual test. 
assword 
For 
Service 
to 
Service 
scenarios 
which 
you 
use 
a service -e 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapCorwoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ Authentication Utility 
Properties 
References 
c* ClientConfiguratio 
c* OAuthHeIper.cs 
packages.config 
ODataUtiIit,' 
@ SoapUtiIit,' 
ServiceTests 
// You need this only if you logon via service principal using a client secret. See: https://docs.microsoft.com/en-us/dynamics365/unified- 
operation s / dev- itpro/ data -entities / services - home- page 
to get more data on how to populate those fields. 
// You can find that under CAD in the azure portal 
ActiveDirectoyResource = "https://rdß111796afae4e7df37devaos.cIoudax.dynamics.com", // Don 't have a trailing "/" . Note: Some of the sample code 
handles that issue. 
ActiveDirectoyTenant = 
"https://loxin.windows.net/votivasoft.com", // Scme samples: https://login.windows.net/yourtenant.onmicrosoft.com, 
Active DirectoyCIientAppId 
"3557saf9 -b6f9 -4a81-9226 -be 7825ad2b8b" , 
ActiveDirectoyCIientAppSecret = " 
// Change TLS version of HTTP request from the client here 
// Ex: TLSVersion - 
// Leave it empty if want to use the default version 
TLSVersion = 
Microsoft Azure 
Votiva • App registrations > An3uiRD01 
iRD01 
Search (Ctrl 
Overview 
Qulckstart 
Manage 
Branding 
Delete Endpoints 
O Got second? We would love purfeed±ck Microsoft identity platform (previousl 
Display name 
Directory (tenant) ID : c82c348b-64ef-4a07-bfa7-62fc38bc1517 
Object ID 
: 87518gg-7gao-4f16-geb8-c1b685bd502ä

 

Update Application (Client) Id from Azure


  1. Prepare (Odata Client Schema) or 3rd Project to integrate with D365 FO

Topic

Generate Odata client schema

 

Step

Screenshot

Description

1

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
Debug 
Tools Test 
Any CPU 
App.config 
Analyze Window Help 
SoapConsoIeAppIication 
Start • 
ODataCIient.tt 
x 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
m program.cs* 
MetadataDocumentVaIidator.cs 
include 
public static class Configuration 
Program.cs 
ClientConfiguration.cs 
// The URI of the metadata document. The value must be set to a valid service document URI or a local file path 
"http:/ .odata.org/V4/OData/OData.svc/", 
"File: // 'C: /Odata . edmx" , 
or XOdata .edmx" 
// Notice If the OData setwice requires authentication for accessing the metadata document, the value of 
// metadataDocumentLlri has to be set to a 
public const string metadataDocumentLlri 
https : / / rda111796afae4e 7df37devaos . cloudax . dynamics . com/data/Smetadata 
// The use of DataSetwiceCoIIection enables entity and property tracking. The value must be set to true or false. 
public const bool LlseDataSetwiceCoIIection = true; 
// The namespace of the client code generated. It replaces the original namespace in the metadata document, 
unless the model has several namespaces. 
public const string Namespaceprefix = 
"0DataUtiIity" ; 
// The target language of the generated client code. The value must be set to "CSharp" 
public const string TargetLanguage = 
"CSharp" ; 
// The path for the temporary file where the metadata xmI document can be stored. Use 
// For example - 
"C: \ xml" 
public const string TempFiIePath = 
this 
"va". 
if 
your 
meta data 
too 
big 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
@ ODataUtiIit,' 
Properties 
References 
ODataCIient.tt 
ODataCIient.ttincIüde 
packages.config 
@ SoapUtiIity 
ServiceTests 
This flag indicates whether to enable naming alias. The value must be set to true or false. 
public const bool EnableNamingAIias = true; 
This flag indicates whether to ignore unexpected elements and attributes in the metadata document and generate 
// the client code if any. The value must be set to true or false.

 

Download at: https://github.com/microsoft/Dynamics-AX-Integration

 

Project: ODataUtility

File: ODataClient.tt

 

Update variable MetadataDocumentUri with your D365 FO, ending with: /data/$metadata

 

Example: MetadataDocumentUri = "https://rd0111796afae4e7df37devaos.cloudax.dynamics.com/data/$metadata"

2

ServiceSampIes 
File Edit View 
m program.cs* 
- Microsoft Visual Studio 
Project Build Debug Team 
Debug 
MetadataDocumentVaIidator.cs 
Tools Test 
Any CPU 
App.config 
Analyze Window Help 
SoapConsoIeAppIication 
O DataCIient.tt 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui • 
Start • 
Program.cs 
ClientConfiguration.cs 
include #> 
public static class Configuration 
The URI of the metadata document. The value must be set to a valid sem.'ice document URI or a local file path 
"http://services.odata.org/V4/OData/OData.svc/", 
"File: ///C: /Odata . edmx" , 
or XOdata .edmx" 
// Notice If the OData setwice requires authentication for accessing the metadata document, the value of 
// metadataDocumentLlri has to be set to a local file path, or the client code generation process will fail. 
public const string metadataDocumentUri = "https://rdø111796afae4e7df37devaos.cIoudax.dynamics.com/data/Smetadata"; 
The use of DataSetwiceCoIIection enables entity and property tracking. The value must be set to true or false. 
public const bool LlseDataSetwiceCoIIection = true; 
The namespace of the client code generated. It replaces the original namespace in the metadata document, 
unless the model has several namespaces. 
public const string Namespaceprefix 
"0DataUtiIity" ; 
The target language of the generated client code. The value must be set to "CSharp" 
public const string TargetLanguage = 
"CSharp" ; 
The path for the temporary file where the metadata xmI document can be stored. Use 
// For example - 
"C: \ xml" 
public const string TempFiIePath = • 
this 
"va". 
if 
your 
meta data 
too 
big 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
@ ODataUtiIit,' 
Properties 
ODataCIient.tt 
ven . Inc 
packages.config 
@ SoapUtiIity 
ServiceTests 
This flag indicates whether to enable naming alias. The value must be set to true or false. 
public const bool EnableNamingAIias = true; 
This flag indicates whether to ignore unexpected elements and attributes in the metadata document 
// the client code if any. The value must be set to true or false. 
public const bool IgnoreLlnexpectedEIementsAndAttributes = true; 
public static class Customization 
and 
generate 
AX 365 FO Mobile 
6bab3-e33a-4dG-bdc 
Open 
Open With... 
View in Browser 
Browse With... 
Scope to This 
New Solution Explorer View 
Exclude From Pro ect 
Run Custom Tool 
ebug T4 Template 
Cut

 

Ctrl-S to save file

Run Custom tool to update latest schema Data entity from your D365 FO

3

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
Debug 
Tools Test 
Any CPU 
Analyze Window Help 
Start 
App.config 
Program.cs 
args) 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
Utilities 
@ Authentication Utility 
t) ODataLltiIity 
@ SoapUtiIity 
ServiceTests 
an.bui 
ODataConsoIeAppIication 
MetadataDocumentVaIidator 
m Program.cs -E X Assemblylnfo.cs 
@JsonConsoIeAppIication 
using System.Web; 
ODataChangesetsExampIe.cs 
OAuthXppConsoIeAppIication.Program 
using System.Security.Authentication; 
using System. Text; 
using System.Security.Cyptography.X5ß9Certificates; 
[S namespace OAuthXppConsoIeAppIication 
12 
14 
19 
25 
29 
31 
33 
100 % 
Error List 
- 
- 
- 
- 
- 
class 
Program 
// In the AOT you will find UserSessionServ'ice in Service Groups and AifLlserSessionServ'ice under Services. 
public static string sessionLlrI = 
" / a pi/ setwices/LlserSes s ionSetwice/ AifLlserSes s ionSetwice/GetLlserSes s ion I nfo" ; 
static void Main (stringC) args) 
string GetLlserSessionOperationPath = 
string. ClientConfiguration .DefauIt.UriString.TrimEnd('/'), ses: 
HttpwebRequest.Create(GetLlserSessionoperationPath); 
var request = 
// If you call GetAuthenticationHeader with true you will the auth via Web App, otherwise via Native App 
-equest. HeadersCoguthHeIper .0AuthHeader] = aguthHeIper- .GetguthenticaticnHeader(useÄebgppguthenticaticn: true) 
request.method = "POST"; 
request. ContentLength = e; 
using (var response = 
using (Stream 
res pon se. GetRes pon seStream ( ) ) 
responseStream = 
usin2 (StreamReader 
streamReader 
— new StreamReader(resoonseStream)) 
Search Error List 
Entire Solution 
Code 
O CS8103 
O CSDD06 
D CS01D8 
Description 
Project 
Combined length of user strings used by the program exceeds allowed limit. TO' to decrease use of string 
O DataUtiIit,' 
csc 
literals. 
Metadata file 
ODataConsoIeA.. 
. csc 
IODataUtiIity.dII' could not be found 
'WorkflowWorkItem.Context' hides inherited member '8aseEntityType.Context'. Use the new kemord if 
ODataCIient.cs 
Line Suppressi.. 
Active 
Active 
6997... Active 
hiding was intended. 
ODataUtiIit,' 
Error List Output 
This item aces nct suppcrt previewing 
Solution Explorer 
Team Explorer 
I' Add tc Scurce Ccntrcl •

 

Build and get error

 

Severity        Code        Description        Project        File        Line        Suppression State

Error        CS8103        Combined length of user strings used by the program exceeds allowed limit. Try to decrease use of string literals.        ODataUtility        D:\Dynamics-AX-Integration-master\ServiceSamples\ODataUtility\CSC        1        Active

 

Topic

Fix error: Combined length of user strings used by the program exceeds allowed limit

 

4

Notepad++ 
Plugins Window ? 
SEE20 
seas 
seas 
SEE2E 
SEE28 
SEE30 
Sééss 
Sééss 
sass 
sass 
SEE40 
sags 
sags 
SEE48 
s€€so 
Sééss 
Sééss 
sass 
sass 
SEEE2 
sues 
sues 
SEE70 
C# source file 
File Edit Search View Encoding Language Settings Tools Macro Run 
change Jog | 0 Datacent ttincIude8 1 
Col: 13 
/// There are no comments for Taxpericds in the schema. 
/ / / < / summary> 
[global : : System. CcdeDom. Compiler . GeneraCedCcdeACCribuCe ("Microsoft . ODaCa . Client . Design .14" 
public void AddToTaxPeIicds (Taxpericd taxpericd) 
base . e cc ( "Taxpeli ads " 
CaxPeriod) ; 
/// There are no comments for AssetMainCenanceW01kOIdeILineICemF01ecasCs in the 
schema . 
/ / / < / summary> 
[global : : System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ("Microsoft . ODaCa . Client . Design .14" 
public void AddToAsseCMainCenanceW01kOIdeILineICemForecasCs (AssetMainCenanceW01kOIdeILineICemForecasC asseCMainCenanceWorkOIdeILineICemForecasC) 
base . e cc ( " s e "Main C I e cas s " 
asseCMainCenanceWorkOIdeILineICemForecasC) ; 
[global : : System. CcdeDom. Compiler . GeneratedCcdeACCribuCe ("Microsoft . ODaCa . Client . Design .14" 
private abstract class GeneratedEd_mYcdeI 
[global : : System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ("Microsoft . ODaCa . Client . Design .14" 
[global : : System. CcdeDom. Compiler . GeneratedCodeÄCCIibuCe ( ' 'Microsoft . CData . . .14 " 
private static global: : Microsoft . ODaCa.Edm. IEd_mYcdeI ParsecLMcdeI 
private const string Edm_x 
LoacLMcdeIFIomSCIing ( ) ; 
Caservice s > 
< Schema Namespace=" 
<EnC 
< PI opercy e 
< PI ope 
< / Key> 
< PI ope ame= 
croso C . 
. C ring 
. C ring 
a se 
VI.Labe11d"" S 
Annotation . Dynamics . ODaCa. Core . 
Annotation . Dynamics . ODaCa. Core . 
< / Annotatio 
< / PI opercy> 
< Property Name= 
aymenC 
Annotation . Dynamics . ODaCa. Core . 
Annotation . Dynamics . ODaCa. Core . 
< / Annotatio 
< / PI opercy> 
< Property Name= 
s c r IpC Ion 
Annotation . Dynamics . ODaCa. Core .VI . 
Annotation . Dynamics . ODaCa. Core . VI 
a se > 
Annotation . Dynamics . ODaCa. . VI . Labelld"" String=" 
Annotation . Dynamics . ODaCa.Core.VI . CcunCryRegionCcdes"" String=" 
VI. AllowEdic"" 
Annotation . Dynamics .VI. IsRequired"" / 
. Cring > 
Annotation . Dynamics . ODaCa. Core . VI . CcunCryRegi 
< / Annotatio 
< / PI opercy> 
Ann o C a on Term= 
Annotation T 
< CyType> 
<EnCi C 
< PI opercy e 
< ProoeICvRef 
croso C . 
C r Ing= 
C r Ing= 
length: 
lines : 
1,522307 
Ln: 358,594 
sel: 301,58 
Windows (CR IF) 
UTE 8

 

Mở file ODataClient.cs của Project OdataUtility bằng Notepad++

Kiếm tá»›i dòng code: private const string Edmx = @"<……>"

Cắt hết tất cả nội dung XML ra 1 file riêng

5

- Notepacl++ 
File Edit Search View Encoding Language Settings Tools Macro Run Plugins Window ? 
o DataC1ient cs I "newlal 
changelog I O DataCIient ttinclude 
. O"" xmlns :edmx=""http: / /docs . 
<edmx : Data. Servi ces> 
«Schema cs . DataEntities"" xmlns=" "http: / /docs . oasis—open.oru/odata/ns 
«Enti tyType Name= " " cPaymentType " " > 
«Key > 
< PropertyRef Name= " "dataAreaId" " / > 
<PropertyRef Name= " " PaymentType " " / > 
Replace 
< / Key > 
«Property Name=" "dataAreaId" " Type=" "Edm. String" 
«Annotation Term=" "Mi crosoft. Dynami os . OData. 
«Annotati on Term=" "Mi . Dynami cs . OData. 
crosoft . Dynami os . OData . Core . 
Find 
Replace BndinFiIes Mark 
Find 'Nhat : 
< 'Anno ta t on > 
< / Property> 
«Property Name= " " Paymen tType " " 
Type=" "Edm. Strin 
«Annota t ion Term=" "Microsoft . Dynamics . OData . 
«Annotation Term=" "Mi . Dynami os . OData . 
«Annotation Term=" . Dynami os . OData. 
«Annotation Term=" . Dynami cs . OData. 
«Annotati on Term=" . Dynami cs . OData . 
[n selecbon 
crosoft . Dynami os . OData . Core . 
< 'Anno ta t on > 
< / Property> 
«Property Name=" "Description" " Type=" "Edm. Strin 
«Annotation Term=" "Mi . Dynami os . OData . 
«Annotation Term=" . Dynami os . OData. 
«Annotati on Term=" "Mi . Dynami cs . OData. Co 
crosoft . Dynami os . OData . Core . VI . 
< 'Anno ta t on > 
< / Property> 
«Annota t ion Term=" "Mi . os . OData . Core 
«Annotation Term=" . OData. Core. VI . CountryRegionCodes" " String= 
< / En t i tyType> 
«Enti tyType Name= " "ExpensePaymentDetai Is " " > 
«Key > 
< PropertyRef Name= " "dataAreaId" " / > 
<PropertyRef Name=" " celd" " / > 
<PropertyRef Name= " " ExpNumber " " / > 
<PropertyRef Name= " " " " / > 
< / Key > 
«Property Name=" "dataAreaId"" Type=" "Edm. String"" 
«Annotation os . OData.Core.VI . LaheIId"" 
«Annotati on cs . OData. Core. VI . 
crosoft . Dynami os . OData . Core . VI . AXType/ 
< 'Anno ta t on > 
< / Property> 
[2 Backward dir ection 
Match L'hole nord only 
Match gase 
[Z] W rap around 
-Search Mode 
@Normal 
o 
Extended On, it, IP, lx...) 
matches newline 
Replace AII in AII Qpened 
[Z] Tr anspar ency 
@On bsing focus 
C) Always

 

Paste ra file notepad++, và lưu thành edmx.xml, replace 2 dấu nháy kép thành 1 dấu nháy kép, lưu file lại ngay folder của project OdataUtility và ODataConsoleApplication

6

SAMSUNG 512G8 SSD (D:) Dynamics-AX-Integration-master 
Date modified 
12/7/2019 12:25 AM 
ServiceSampIes 
Type 
File folder 
O DataUtiIity 
Size 
Search ODataUtiIity 
Properties 
edmx x ml 
ODataCIient.cs 
O DataCIient.tt 
ODataCIient.ttincIude 
ODataUtiIity.csproj 
packages.config 
Notepad++ 
File Edit Search View Encoding Language Settings Tools Macro Run Plugins Window ? 
change Jog 0 Datacentttinclude O 
— . O xmlns : edm_x="http: / 'docs . oasis—open. ora/odata/ns /edmx" 
Dataservices> 
< Schema .DataEntities" xmlns="http: / 'docs 
<EnCi CyType 
< PI operCyRef 
< PI operCyRef 
< / Key> 
< Property String" 
<AnnoCaCion orosoft.Dynamios .0Data.Core.VI . Labelld" 
Annotation T orosoft.Dynami os . OData. Core. VI . 
<EnumMemhe crosoft . Dynami os . OData . Core . VI . AXType/ String< / Enurtü•lemhe 
< / PI opercy> 
< Property String" 
<AnnoCaCion T Dynamics 
.0Data.core.V1. 
Annotation orosoft.Dynami os . OData.Core.VI . CountryRegionCodes" 
Annotation os . OData.Core.VI .AIIowEdit" / > 
<AnnoCaCion orosoft.Dynamios .0Data.Core.VI . IsRequired" 
Annotation T orosoft. Dynami os 
. OData . core . vi . 
. Dynamics . OData . Core . VI . AXType/ String< / Enumyemher> 
< / PI opercy> 
< Property 
<AnnoCaCion T orosoft.Dynamios . OData. Core 
.vl. string=ngsys7576" 
Annotation os . OData.Core.VI . CountryRegionCodes" 
Annotation T os . Core. VI .

 

Lưu file edmx.xml lại file vào project ODataUtility:

7

ThisPC SAMSUNG 512G8SSD 
Name 
Zh- Hans 
zh-Hant 
AuthenticationUtiIity.dII 
AuthenticationUtiF db 
edmx.xml 
Dynamics-AX-Integration-master ServiceSampIes ODataConsoIeAppIication 
bin 
Debug 
Microsoft. IdentityModeI. Clients.ActiveDi... 
Microsoft. IdentityMod el.CIients.ActlveDi... 
Date modified 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/7/2019 1:03 AM 
12/8/2019 12:31 AM 
12/8/2019 12:31 AM 
12/8/201; AM 
— 1272016 1:41 PM 
12/2/2016 1:41 PM 
Type 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
File folder 
Application exten... 
Pro ram Debu D.. 
XML Document 
Application extern... 
Application extern... 
Size 
18 G 
20,318 KB 
88 KB

 

Lưu file edmx.xml lại file vào project ODataConsoleApplication, path: D:\Dynamics-AX-Integration-master\ServiceSamples\ODataConsoleApplication\bin\Debug

8

changelog ODataCEentttincIude I edmxxml 
SEEgs 
5EEgg 
SE700 
SE70s 
SE70E 
SE722 
/// There no comments for TaxP±IIcds In the schema. 
/ / / < / s unmary> 
[global : : System. CcdeDom. Compiler . GeneratedCcdeAttr±bute ("MI . CData . CI I ent . Des±gn . TA " 
public AddToTaxP±IIcds taxP±IIcd) 
base . ct ( "TaxPeIi_ " 
taxPer±cd) ; 
/// There no comments for AssetMaIntenanceW01kOId±ILIneItemF01ecasts 
/ / / < / s unmary> 
[global : : System. CcdeDom. Compiler . GeneratedCcdeAttr±bute ("MI . CData . CI I ent . Des±gn . TA " 
In the 
schema . 
public AddToAssetMaIntenanceW01kOId±ILIneItemFozecasts (AssetMaIntenanceW01kOId±ILIneItemFozecast assetMaIntenanceWo 
base . ct ( " s cas s " 
[global : : System. CcdeDom. Compiler . GeneratedCcdeAttr±bute ("MI crosoft . CData . CI I ent . Des±gn . TA " 
private ahstract class GeneratedEd_mMcdeI 
[global : 
priva te 
[global : 
priva te 
[global : 
: System. CcdeDom. Compiler . GeneratedCcdeAttr±bute ("MI . CData . CI I ent . Des±gn . TA " 
stat±c global: : Microsoft . OData.EcLm. ParsecLMcdeI 
: System. CcdeDom.Co . ("MI crosoft . CData. . TA" 
const = 
: System. CcdeDom. Co 
nera dCcdeAttr±bute ("MI . CData . . . TA" 
public stat±c global: . OData.Edm. IEcI_mMcdeI Get Instance ( ) 
re turn ParsecIMcdeI ; 
[global : 
priva te 
: System. CcdeDom. Compiler . GeneratedCcdeAttr±bute ("MI . CData . CI I ent . Des±gn . TA " 
stat±c global: . OData.EcLm.

 

Gán tên file edmx.xml vào biến string Edmx:

9

change]og ODataCEentttincIude | edmxxml 
s€742 
s€743 
s€744 
SE74S 
SE74E 
s€747 
s€748 
Sé7ss 
Sé7ss 
s€7SE 
s€7sg 
sé7€r-• 
return ed_mycdel ; 
finally 
( (global : 
: System. IDisposabIe) (reader) ) 
. Dispose () ; 
[global : 
priva te 
: System. CcdeDom. Compiler . GeneraCedCcdeACCIibuCe ("Mi crosoft . ODaCa . Client . Design .14 " 
static global: : System.XmI . XmIReadeI CreateXmIReadeI (st ling edm_xToParse) 
return global: : SysCem.XmI . XmIReader . Create (new global: : System. 10. SCIingReadeI (edm_xToParse)) ; 
Create new method CreateXmIReacI±I without Parameters 
[global : : System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ("Microsoft . ODaCa . Client . Design .14" 
private static global: : System.XmI . XmIReadeI CreateXmIReadeI ( ) 
return global: : System. Xml . XmIReader . Create (new global: : System. 10. ScreamReadeI (Edm_x) ) ;

 

 

Modify OdataClient.cs

//Create new method CreateXmlReader without Parameters

[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.OData.Client.Design.T4", "7.5.1")]

            private static global::System.Xml.XmlReader CreateXmlReader()

            {

                return global::System.Xml.XmlReader.Create(new global::System.IO.StreamReader(Edmx));

            }

10

sé70E 
SE70g 
56712 
56720 
56721 
SE72E 
"729 
56730 
s€732 
s€733 
s€734 
s€73S 
s€73E 
"737 
s€738 
s€73g 
56740 
s€742 
s€743 
s€744 
SE74S 
SE74E 
s€747 
s€748 
ODataCIientttincIude | edmxxml@ 0 DataCIient cs 
[global : : System. CcdeDom. Compiler . GeneratedCcdeACCribuCe ("Microsoft . ODaCa . Client . Design .14" 
private abstract class GeneratedEd_mYcdeI 
[global : 
priva te 
[global : 
priva te 
[global : 
: System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ("Microsoft . ODaCa . Client . Design .14" 
static global: : Microsoft . ODaCa.Edm. IEd_mYcdeI ParsecLMcdeI 
LoacLMcdeIFIomSCIing ( ) ; 
: System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ( "Microsoft . ODaCa . Client . Design .14" 
const st ling Edm_x = 
: System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ("Microsoft . ODaCa . Client . Design .14" 
public static global: : Microsoft . ODaCa.Edm. IEd_mYcdeI Get Instance ( ) 
return ParsedMcdeI ; 
[global : : System. CcdeDom. Compiler . GeneratedCcdeACCIibuCe ("Microsoft . ODaCa . Client . Design .14" 
private static global: : Microsoft . ODaCa.Edm. IEd_mYcdeI LoacLMcdeIFromSCIing() 
/ / global: : System.XmI.XmIReacI±I = 
CreateXmAReacI±I (EcLm_x) ; 
global: : System.XmI . XmIReadeI reader = ( ) ; 
global : 
global : 
: System. Collections . Generic . IEnumerabIe<gIobaI : 
: Microsoft . ODaCa . Edm. IEd_mYcdeI ed_mycdel; 
:MicrosofC . ODaCa . Edm.VaIidaCion . EdmError> errors ; 
if ( ! global: 
global : 
forea oh 
:MicrosofC . ODaCa.Edm. CsdI . . Tryparse (reader, true, out ed_mycdel, 
out errors)) 
: System. Text . SCIingBuiIder errorMessages 
(var e: 101 in errors) 
el 101Messages . Append (21101 . E1101Message) ; 
el 101Messages . Append ( " 
throw new global : 
return ed_mycdel ; 
new System. Text . SC ringBuiIder() ; 
: System. InvalidOperaCionExcepCion (errorMessages . ToSCring O ) ; 
finally 
( (global : 
: System. IDisposabIe) (reader) ) 
. Dispose () ;

 

Update LoadModelFromString to call the new overload of CreateXmlReader() so it loads the Edmx from the XML file

11

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
"7.5.1")) 
"7.5.1")) 
Tools Test 
Any CPU 
Analyze Window Help 
ODataConsoIeAppIication 
Start • 
Program.cs 
m program.cs 
ODataUtiIity 
Debug 
ODataChangesetsExampIe.cs 
finally 
MetadataDocumentVaIidator.cs 
App.config 
O DataCIient.cs 
x 
•r•a ODataUtiIity.MicrosoftDynamics.DataEntities.Resources. • 
CreateXmIReaderO 
56743 
56744 
56745 
56746 
56747 
56748 
5 674 g 
5675e 
56751 
56752 
56753 
56754 
56755 / 
56756 
56757 
56758 
56759 
5676e 
56761 
56762 
56763 
56764 
56765 
56766 
56767 
56768 
100 % 
Output 
( (global: :System. IDisposabIe) (reader)) . Dispose() ; 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
O DataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
ODataUtiIit,' 
ServiceTests 
- 
- 
- 
private 
[globa I : : System. CodeDom. Compiler. Gen eratedCod eAttribute ( "Mic rosoft. OData . Client. Des ign . T4" , 
static global: :System.XmI.XmIReader 
CreateXmIReader(string 
edmxToPa r s e) 
return global: global: :System. 10. StringReader(edmxToParse)); 
/ 'Create new method CreateXmIReader without Parameters 
[global : : System. CodeDom. Compiler. Gen eratedCod ( "Mic rosoft. OData . Client. Des ign . T4" , 
private static global: :System.XmI.XmIReader 
CreateXmIReader ( ) 
return global: global: :System. 10. StreamReader(Edmx)); 
There are no corments for ElectronicPaymentTypeSingIe in the schema. 
[globa I : : Mic rosoft. OData . Client. Origin a INameAttribute ( " Electron ic PaynentTypeSingIe" ) 
public partial class 
ElectronicPaymentTypeSingIe : 
global : : rosoft. OData . Client. Data eQu 
Show output from: Build 
Rebuild All started: Project: ODatalJtiIity, Configuration: Debug Any CPU 
396834, 38): warning CSßIß8. 
• 'Workflow-Workltem. Conte 
ODatalJtiIit 
- > D: narnics-AX-Inte ration-rraster\ServiceSarr 
Rebuild All: I succeeded, failed, skipped

 

Rebuild OdataUtility project


  1. Sample OdataConsoleApplication

Topic

Review sample OdataConsoleApplication

 

Step

Screenshot

Description

1

ServiceSampIes - Microsoft Visual Studio 
Edit View Project Build Debug Team 
Tools Test 
Any CPU 
App.config 
Analyze Window Help 
ODataConsoIeAppIication 
Start • 
ODataChangesetsExampIe.cs 
args) 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
-01 
m program.cs* 
Debug 
MetadataDocumentVaIidator.cs 
Program.cs -a X 
ClientConfiguration.cs 
ODataConsoIeAppIication 
Susing Authenticationutility; 
using Microsoft.OData .CIient; 
ODataConsoIeAppIication. Program 
using ODataLltiIity.Microsoft.Dynamics .DataEntities; 
using System; 
using System. Ling; 
[S namespace ODataConsoIeAppIication 
class 
Program 
ClientConfigu ration . Default. LlriString 
ODataCIient.tt 
"data"; 
public static string ODataEntityPath — 
static void Main (stringC) args) 
13 
21 
- 
- 
// To test custom entities, regenerate "ODataCIient.tt" file. 
// https://bloxs.msdn.microsoft.com/odatateam/2ß14/ß3/II/tutoriaI-sampIe-how-to-use 
client-side-proxy-class/ 
Uri 
oDataLlri = 
new Uri (ODataEntityPath, 
IJriKind . Absolute) ; 
var context = new Resources (oDataLlri); 
-odata - c code-generator-to-generate- 
e) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ ODataConsoIeAppIication 
mpe les 
References 
App.config 
C* MetadataDocumentVaIidator.cs 
C* ODataChangesetsExampIe.cs 
packages.config 
C* Program.cs 
C* QueryExampIes.cs 
c* SimpleCRUDExampIes.cs 
@ PHPConsoIeAppIication 
@ SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
ODataUtiIity 
SoapUtiIit,' 
ServiceTests 
context.SendingRequest2 new (object sender, SendingRequest2EventArgs 
var authenticationHeader — 
OAuthHeIper.GetAuthenticationHeader(useWebAppAuthentication: true) • 
e. Requestmessage.SetHeader(OAuthHeIper.OAuthHeader, authenticationHeader); 
// Llnccmment below to run specific examples

 

Find project: ODataConsoleApplication

2

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
Debug 
Tools Test 
Any CPU 
App.config 
Analyze Window Help 
ODataConsoIeAppIication 
Start • 
O DataChangesetsExampIe.cs 
args) 
Quick Launch (Ctrl+Q) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
an.bui 
m program.cs* 
Metadata DocumentVaIidator 
Program.cs -E X ClientConfiguration.cs 
ODataConsoIeAppIication 
Susing Authenticationutility; 
using Microsoft.OData .CIient; 
ODataConsoIeAppIication.Program 
using ODataLltiIity.Microsoft.Dynamics .DataEntities; 
using System; 
using System. Ling; 
[S namespace ODataConsoIeAppIication 
class 
Program 
ClientConfigu ration . Default. LlriString 
ODataCIient.tt 
"data"; 
public static string ODataEntityPath — 
static void Main (stringC) args) 
13 
21 
- 
- 
// To test custom entities, regenerate "ODataCIient.tt" file. 
// https://bloxs.msdn.microsoft.com/odatateam/2ß14/ß3/II/tutoriaI-sampIe-how-to-use 
client-side-proxy-class/ 
Uri 
oDataLlri = 
new Uri(ODataEntityPath, 
IJriKind . Absolute) ; 
var context = new Resources (oDataLlri); 
-odata - c code-generator-to-generate- 
context.SendingRequest2 new 
(object 
sender, 
SendingRequest2EventArgs 
e) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
ODataConsoIeA lication 
Buil 
Rebuild 
Clean 
Analyze 
Publish... 
Scope to This 
New Solution Explorer View 
Build Dependencies 
Manage NuGet Packages.. 
Set as StartUp Project 
ebug

 

Set Startup project

3

Servi ceSampIes (Running) 
File Edit View Project 
- Microsoft Visual Studio 
Build Debug Team 
9 
Tools Test 
Any CPU 
Analyze Window Help 
ODataCcnscIeAppIicaticn 
Lifecycle &.'ents Thread: 
Process: [21248] ODataConsoIeAppIication. • 
Continue • 
•6 Stack Frame: 
ODataCIient.tt 
ODataChangesetsExampIe.cs a 
SoapHeIper.cs 
Program.cs 
QueryExampIes.cs a 
MetadataDocumentVaIidator.cs 
Program.cs 
ODataConsoIeAppIication.Program 
Assemblylnf 
Mail 
ODataConsoIeAppIication 
Susing Authenticationutility; 
using Microsoft.OData .CIient; 
using ODataLltiIity.Microsoft.Dynamics .DataEntities; 
using System; 
using System. Ling; 
[S namespace ODataConsoIeAppIication 
class 
Program 
public 
static 
static string ODataEntityPath — 
void Main (stringC) args) 
Name: 
Name : 
ClientConfiguratio 
Name : 
Name : 
Name : 
Name : 
13 
21 
- 
- 
To test custom entities, regenerate "ODataCIient.t 
Name : 
htt s: 
blo s.msdn.microsoft.com odatateam 2ß14 
Name : 
Ll.-i coatal_lri = 
var context 
Name : 
new Llri(OÜataEntityPath, LlriKind .ßbsoILName: 
new Resources (oDataLlri); 
context.SendingRequest2 new EventHandIer<SendingRe 
var authenticationHeader — 
OAuth Helper. GetAuthent 
e. Req uestmes sage. SetHeader (OAuth Helper. OAuthHead e 
// Uncorment below to run specific examples 
// I. Simple query examples 
QueyExampIes . ReadLegaIEntities (context) ; 
Qu eyExampIes . Getln nt (context) ; 
Qu eyExampIes . GetTopRecords (context) ; 
QueyExampIes . Filtersyntax(context) ; 
QueyExampIes . F ilterLinqSyntax(context) ; 
// QueyExampIes . Sortsyntax(context); 
// QueyExampIes . Filter3yCompany(context); 
// QueyExampIes . ExpandNavigationaIProperty(context); 
// 2. Simple CRUD examples 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Name : 
Total 
dat 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
usel 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
Contoso 
vendors 
Group 
Entertainment System 
Entertainment System Germany 
Entertainment System USA 
Consulting 
Consulting FR 
Consulting USA 
Consulting GB 
Retail 
Retail USA 
Retail FR 
Entertainment Japan 
Entertainment System Brazil 
Entertainment System India 
Entertainment China 
Entertainment System Russia 
Process Industry 
Orange Juice 
Retail RUS 
Entertainment System Mexico 
Entertainment System Malaysia 
Entertainment System Saudi Arabia 
Entertainment System Thailand 
Italy 
is 49 
Vendor with ID US TX 881 retrived . 
Vendor with ID US TX 882 retrived . 
Vendor with ID LIS TX 883 retrived.

 

Start and Debug ODATAConsoleApplication sample


  1. Sample customize SOAP Service to check Item On-hand

Topic

Prepare service in AOT

 

Step

Screenshot

Description

1

 

VtvTestCustomDataEntity .xpp 
VtvItemOnhandContract 
VtvItemOnhandCcntract.xpp 
x 
VtvInventoryCustomServicesGroup 
DataContractAttribute 
public class 
Itemld 
InventLocationId 
WSLocationId 
U n itOfmea s u reSymboI 
2 
ontraqe 
itemld ; 
inventLocationId ; 
wms Location Id ; 
_qty ; 
inventLln ; 
CDatamemberAttribute) 
public Itemld Itemld (Itemld 
item Id 
item I d) 
VtvInventoryCustomServicesCIass.xpp 
inventLocationId) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'VtvCustomDataEntityStore' (I project) 
VtvCustomDataEntityStore (VAR) [VB I] 
References 
Classes 
VtvItemOnhandContract 
Data Entities 
Data Entity Extensions 
Security Privileges 
Service Groups 
VtvInventoryCustomServicesGroup 
Services 
VtvInventoryCustomServices 
Tables 
12 8 
19 8 
26 8 
33 8 
item Id 
return 
itemld ; 
itemld ; 
CDatamemberAttribute) 
public InventLocationId Warehouseld (InventLocationId 
inventLocationId — 
inventLocationId ; 
inventLocationId ; 
return 
CDatamemberAttribute) 
inventLocationI 
Solution Explorer Team Explorer 
Properties 
Class View 
public WSLocationId Locationld (IBSLocationId MnsLocationId 
MnsLocationId = MnsLocationId; 
vans Locationld) 
return vans Locationld ; 
CDatamemberAttribute) 
public Qty OnHandQty(Qty qty 
_qty = qty; 
return _qty; 
CDatamemberAttribute) 
_qty) 
public UnitOfmeasureSymboI InventLlnitId (UnitOfmeasureSymboI inventLlnitId 
inventLlnitId 
= inventLlnitId; 
inventLln ; 
return 
inventLlnitId)

 [DataContractAttribute]

public class VtvItemOnhandContract

{

    ItemId                  _itemId;

    InventLocationId        _inventLocationId;

    WMSLocationId           _wmsLocationId;

    Qty                     _qty;

    UnitOfMeasureSymbol     _inventUnitId;

                  

    [DataMemberAttribute]

    public ItemId ItemId(ItemId itemId = _itemId)

    {

        _itemId = itemId;

        return _itemId;

    }

 

    [DataMemberAttribute]

    public InventLocationId WarehouseId(InventLocationId inventLocationId = _inventLocationId)

    {

        _inventLocationId = inventLocationId;

        return _inventLocationId;

    }

 

    [DataMemberAttribute]

    public WMSLocationId LocationId(WMSLocationId wmsLocationId = _wmsLocationId)

    {

        _wmsLocationId = wmsLocationId;

        return _wmsLocationId;

    }

 

    [DataMemberAttribute]

    public Qty OnHandQty(Qty qty = _qty)

    {

        _qty = qty;

        return _qty;   

    }

 

    [DataMemberAttribute]

    public UnitOfMeasureSymbol InventUnitId(UnitOfMeasureSymbol inventUnitId = _inventUnitId)

    {

        _inventUnitId = inventUnitId;

        return _inventUnitId;

    }

 

}


Create new data contract: VtvItemOnhandContract

 

 

2

VtvTestCustomDataEntity .xpp 
*1:' VtvInventoryCustomServicesCIass 
VtvItemOnhandContract.xpp 
VtvInventoryCustomServicesGroup 
VtvInventcryCustcmSer.'icesCIass.xpp 
x 
public class VtvInventoyCustomSe'"'icesCIass 
AifCoIIectionTypeAttribute( ' return' , Types: : Class, 
getItemOnhand(Llst itemOnhandContractRequestL15t) 
class Str (VtvItemOnhandContra ct)) , 
AifCoIIectionTypeAttribute( ' itemOnhandContractRequestList ' , Types : : Class , classStr(VtvIterrOnhandContract)) 
ListEnumerator 
List 
VtvItemOnhandContract 
VtvItemOnhandContract 
InventDim 
InventDimParm 
Inventonhand 
Itemld 
InventLocationId 
WSLocationId 
Un itOfmea s u reSymboI 
listEnum = 
itenon h a ndContra ctReq uestList. getE n umerator ( ) ; 
resultList 
new List(Types: :CIass) 
itenOnhandContract; 
itenon h a ndContra ctRetu rn ; 
qty; 
inventDim; 
inventDimParm; 
inventonhand; 
itemld ; 
inventLocationId ; 
wms Loc ationld; 
inventLln ; 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'VtvCustomDataEntityStore' (I project) 
VtvCustomDataEntityStore (VAR) [V B I] 
References 
VtvInventoryCustomServicesCIass 
VtvTestCustomDataEntity 
Data Entities 
Data Entity Extensions 
Security Privileges 
Service Groups 
VtvInventoryCustomServicesGroup 
Services 
VtvInventoryCustomServices 
Tables 
Views 
Solution Explorer Team Explorer 
Properties 
Class View 
while (listEnum.moveNext()) 
itenon ha ndContra ct 
item Id 
inventLocationId 
vas Location Id 
listEnum. current(); 
itenOnhandContract. Itemld ; 
itemOnhandContra ct . seld ; 
itenOnhandContract. Location Id ( ) ; 
if (itemld 88 inventLocationId) 
inventDim. clear() ; 
inventDim. InventLocationId 
inventDim. InventSiteId 
inventDim. Id 
inventDimParm. clear() ; 
= inventLocationId; 
InventLocation : : find (inventLocationId) . InventSiteId ; 
wms Loc ationld; 
inventDimPa rm. in itF romInventDim(inventDim) ; 
inventonhand 
inventLlnitId 
Inventonhand: : newparameters (itemld, inventDim, 
inventonhand . availPhysicaI(); 
InventTabIe: : find (itemld ) . inventLlnitId ; 
inventDimPa rm) ; 
itenOnhandContractReturn = 
new VtvItemOnhandContract(); 
itenonha ndContra ctReturn . Itemld (itemld ) ;

 public class VtvInventoryCustomServicesClass

{

    [

        AifCollectionTypeAttribute('return', Types::Class, classStr(VtvItemOnhandContract)),

        AifCollectionTypeAttribute('itemOnhandContractRequestList',Types::Class,classStr(VtvItemOnhandContract))

    ]

    public List getItemOnhand(List    itemOnhandContractRequestList)

    {

        ListEnumerator          listEnum = itemOnhandContractRequestList.getEnumerator();

        List                    resultList = new List(Types::Class);

        VtvItemOnhandContract   itemOnhandContract;

        VtvItemOnhandContract   itemOnhandContractReturn;

 

        Qty                     qty;

        InventDim               inventDim;

        InventDimParm           inventDimParm;

        InventOnhand            inventOnhand;

        ItemId                  itemId;

        InventLocationId        inventLocationId;

        WMSLocationId           wmsLocationId;

        UnitOfMeasureSymbol     inventUnitId;

 

        ;

        while (listEnum.moveNext())

        {

            itemOnhandContract  = listEnum.current();

 

            itemId              = itemOnhandContract.ItemId();

            inventLocationId    = itemOnhandContract.WarehouseId();

            wmsLocationId       = itemOnhandContract.LocationId();

 

 

            if(itemId && inventLocationId) 

            {

                inventDim.clear();

                inventDim.InventLocationId  = inventLocationId;

                inventDim.InventSiteId      = InventLocation::find(inventLocationId).InventSiteId;

                inventDim.wMSLocationId     = wmsLocationId;

 

                inventDimParm.clear();

                inventDimParm.initFromInventDim(inventDim);

 

                inventOnhand    = InventOnhand::newParameters(itemId, inventDim, inventDimParm);

                qty             = inventOnhand.availPhysical();

                inventUnitId    = InventTable::find(itemId).inventUnitId();

 

                itemOnhandContractReturn = new VtvItemOnhandContract();

                itemOnhandContractReturn.ItemId(itemId);

                itemOnhandContractReturn.LocationId(wmsLocationId);

                itemOnhandContractReturn.WarehouseId(inventLocationId);

                itemOnhandContractReturn.InventUnitId(inventUnitId);

                itemOnhandContractReturn.OnHandQty(qty);

 

                resultList.addEnd(itemOnhandContractReturn);

            }

        }

        return resultList;

 

    }

 

}

Create new service class: VtvInventoryCustomServicesClass

 


 

3

Add New Item - VtvCustomDataEntityStore (VAR) [V81] 
Installed 
Dynamics 365 Items 
Analytics 
Business Process and Workflow 
Code 
Configuration 
Data Model 
Data Types 
Labels And Resources 
Reports 
Security 
Services 
User Interface 
D Online 
Sort by. 
Default 
Service 
Service Group 
Dynamics 365 Items 
Dynamics 365 Items 
Search Installed Templates (Ctrl+E) 
Type: Dynamics 365 Items 
Create a Service 
Click here to go online and find templates. 
VtvInventoryCustomServices

 

Add new service: VtvInventoryCustomServices

4

VtvInventcryCustcmSer.'ices -E X 
Search 
(b VtvInventoryCustomServices (var) [V81] 
emce peratlons 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'VtvCustomDataEntityStore' (I project) 
VtvCustomDataEntityStore (VAR) [V B I] 
References 
Classes 
VtvInventoryCustomServicesCIass 
VtvItemOnhandContract 
VtvTestCustomDataEntity 
Data Entities 
Data Entity Extensions 
Security Privileges 
Service Groups 
VtvInventoryCustomServicesGroup 
Services 
VtvInventoryCustomServices 
Solution Explorer Team Explorer Class View 
Properties 
Service VtvInventoryCustomServices 
Description 
External Name 
Is Obsolete 
Na me 
Namespace 
Tags 
Vtv I nvento ryCusto mServicesCIass 
Vtv nvento ryCusto mSe rvices 
Vtv I nvento ryCusto mServices 
Vtv I nvento ryCusto m Services 
microsoft.com/dynamics/2011101 [services

 

Set Properties for Service:

Class: VtvInventoryCustomServicesClass

Description: VtvInventoryCustomServices

External name: VtvInventoryCustomServices

 

Namespace: http://schemas.microsoft.com/dynamics/2011/01/services

 

5

VtvInventcryCustcmSer.'ices -E X 
Search 
VtvInventoryCustomServices (var) [V81] 
Service O erations 
New Service Operation 
Find 
Compare 
Properti es 
Alt * Enter

 

New Operation for Service

6

VtvInventcryCustcmSer.'ices• -E X 
Search 
VtvInventoryCustomServices (var) [V81] 
Service O erations 
getItemOnhand 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'VtvCustomDataEntityStore' (I project) 
VtvCustomDataEntityStore (VAR) [V B I] 
References 
Classes 
VtvInventoryCustomServicesCIass 
VtvItemOnhandContract 
VtvTestCustomDataEntity 
Data Entities 
Data Entity Extensions 
Security Privileges 
Service Groups 
VtvInventoryCustomServicesGroup 
Services 
VtvInventoryCustomServices 
Solution Explorer Team Explorer Class View 
ropertles 
ServiceOperation getItemOnhand 
Enable Idempotence 
Method 
Operational domain 
Subscriber access level 
Tags 
Yes 
get ItemOnhand 
get ItemOnhand 
NotSpecified 
Unset

 

Set Properties for new operation

7

Add New Item - VtvCustomDataEntityStore (VAR) [1181] 
Installed 
Dynamics 365 Items 
Analytics 
Business Process and Workflow 
Sort by. Default 
Service 
Service Group 
Dynamics 365 Items 
Dynamics 365 Items 
Search Installed Templates (Ctrl+E) 
Type: Dynamics 365 Items 
Create a Service Group 
Code 
Configuration 
Data Model 
Data Types 
Labels And Resources 
Reports 
Security 
Services 
User Interface 
D Online 
Vtvlnvento 
Click here to go online and find templates. 
CustomServicesGrou

 

Add new service group: VtvInventoryCustomServicesGroup

8

VtvInventcryCustcmServicesGrcup -E X 
Search 
VtvInventoryCustomSer.'icesGroup (var) [V81] 
VtvInventoryCustomServices 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'VtvCustomDataEntityStore' (I project) 
VtvCustomDataEntityStore (VAR) [V B I] 
References 
Classes 
VtvInventoryCustomServicesCIass 
VtvItemOnhandContract 
VtvTestCustomDataEntity 
Data Entities 
Data Entity Extensions 
Security Privileges 
Service Groups 
VtvInventoryCustomServicesGroup 
Services 
VtvInventoryCustomServices 
Tables 
Solution Explorer Team Explorer Class View 
Properties 
ServiceGroup VtvInventoryCustomServicesGroup 
Auto Deploy 
Description 
Is Obsolete 
Na me 
Tags 
Vtv I nvento ryCusto mSe rvicesG roup 
Vtv nvento ryCusto m Se rvicesG roup

 

Set properties for new service group:

Auto deploy: YES

9

VtvInventcryCustcmServicesGrcup 
Search 
tv nventory ustom ervvces 
Vtvlnven 
Solutio 
roup var 
Find references 
View Hierarchy 
New Service 
Open table browser 
Tags 
Find 
Compare 
Properti es 
81] 
Alt + o 
Alt + Enter

 

Add new service into service group

10

VtvInventcryCustcmServicesGrcup• -E 
Search 
Vtvlnvento Custom ServicesGrou 
VtvInventoryCustomServices 
var) 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'VtvCustomDataEntityStore' (I project) 
VtvCustomDataEntityStore (VAR) [V B I] 
References 
Classes 
VtvInventoryCustomServicesCIass 
VtvItemOnhandContract 
VtvTestCustomDataEntity 
Data Entities 
Data Entity Extensions 
Security Privileges 
Service Groups 
VtvInventoyCustomServicesGroup 
Services 
VtvInventoryCustomServices 
Tables 
Solution Explorer Team Explorer Class View 
Properties 
ServiceGroupService VtvInventoryCustomServices 
Name 
Service 
Tags 
Vtv I nvento ryCusto mSe rvices 
Vtv I nvento ryCusto mSe rvices

 

Set properties for service in service group

11

Full build 
Packages Options 
Packages [Models] 
[3 SourceDocumentation [SourceDocumentation] 
[3 SourceDocumentationTypes [SourceDocumentationTypes] 
[3 Subledger [Subledger] 
[3 SystemHeaIth [SystemHeaIth] 
D Tax 
[3 TaxEngine [Tax Engine] 
[3 TestEssentiaIs [Test Essentials] 
[3 TimesheetMobiIe [Timesheet Mobile] 
Tutorial [Tutorial] 
[3 UnitOfMeasure [Unit of measure] 
V81 
[3 WHSAppTaskVaIidator [Warehouse Mobile App Task Validator] 
[3 WMSAdvancedMigration [WMSAdvancedMigration] 
A Referenced packages 
[3 Build referenced packages [models] 
Details 
Build

 

Full build your model

12

Services 
File Action View Help 
W nd 
i cws Search 
Windows Sync Share 
Services (Local) 
ices (Local) 
World Wide Web Publishing Service 
Stop the service 
Restart the service 
Description: 
Provides Web connectivity and 
administration through the Internet 
Information Services Manager 
Name 
Windows Management Instrumentation 
Windows Mobile Hotspot Service 
Windows Modules Installer 
Windows Phone IP over USB Transport (IpOverU... 
Windows Presentation Foundation Font Cache 3... 
Windows Process Activation Service 
Windows Push Notifications System Service 
Windows Push Notifications User Service be6cd4 
Windows Remote Management (WS Managem... 
Windows Time 
Windows Update 
WinHTTP Web Proxy Auto-Discovery Service 
Wired AutoConfig 
'"MI Performance Adapter 
World Wide Web Publishing Service 
XBox Live Game Save 
Description 
Provides a c... 
Provides th... 
Enables inst... 
Enables co... 
Optimizes p... 
The Windo... 
This service 
This service 
Windows R... 
Provides co... 
The Windo... 
Maintains d... 
Enables the 
WinHTTP i... 
The Wired 
Provides pe... 
Creates and. 
Provides VI... 
Provides au... 
This service 
Status 
Running 
Running 
Running 
Running 
Running 
Running 
Running 
Running 
Running 
Running 
Running

 

Restart service: World Wide Web Publishing Service

13

erd01117%afae4e7df37deva... 
<?xml encoding="UTF-8"?> 
< wsdl: definitions xmlns: soapenc= "http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl' xmlns:soap="http:/'schemas.xmlsoap.org/wsdl/soap/" 
"http://tempuri.org/" xmlns :xsd= "http://www.w3.org/2001/XMLSchema" 
xmlns: wsam = "http://vvww.w3.org/2007/05/addressing/metadata" 
xmlns: wsa= "http://schemas.xmIsoap.org/ws/2004/08/addressing" 
xmlns:soapl " http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:msc = "http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns: wsap= " http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns : wsp= " http://www.w3.org/ns/ws-policy" 
xmlns: wsal "http://www.w3.org/2005/08/addressing" xmlns : wsu = " http://docs-oasis-open.org/wss/2004/01/oasis- 
200401-wss-wssecurity-utility-l. O .xsd" xmlns:iO= "http://schemas.microsoft.com/dynamics/2011/01[services" 
xmlns: wsx= "http://schemas.xmlsoap.org/ws/2004/09/mex" xm Ins : wsdl= "http://schemas.xmlsoap.org/wsdl/" 
targetNamespace="http://tempuri.org/" name="VtvInventoryCustomServicesGroup"> 
<wsp:Policy wsu:Id—"BasicHttpBinding_VtvInventoryCustomServices_poIicy"> 
< wsp: ExactlyOne> 
< wsp : All> 
:TransportBin ding " http://schemas.xmlsoap.org/ws/2005/07/securitypolicy" > 
< wsp:Policy> 
< sp : TransportToken> 
< wsp:Policy> 
<sp:HttpsToken RequireClientCertificate="false"/> 
</wsp: Policy > 
</sp : TransportToken> 
<sp:AlgorithmSuite> 
< Wisp: Policy > 
<sp:Basic256/> 
</wsp: Policy > 
</sp : Algorithm Suite > 
: Layout) 
<wsp:Policy> 
: Strict/> 
</wsp: Policy> 
</sp : Layout) 
</wsp:Policy> 
</sp:TransportBinding> 
</wsp : All> 
</wsp : ExactlyOne> 
</wsp:Policy>

 

Testing open SOAP WSDL in Browser at Local server

Example link: https://rd0111796afae4e7df37devaos.cloudax.dynamics.com/soap/services/VtvInventoryCustomServicesGroup?wsdl

 

If result look like screenshot, your service is okie at local server

14

erd01117%afae4e7df37deva... 
<?xml encoding="UTF-8"?> 
< wsdl: definitions xmlns: soapenc= "http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl' xmlns:soap="http:/'schemas.xmlsoap.org/wsdl/soap/" 
"http://tempuri.org/" xmlns :xsd= "http://www.w3.org/2001/XMLSchema" 
xmlns: wsam = "http://vvww.w3.org/2007/05/addressing/metadata" 
xmlns: wsa= "http://schemas.xmIsoap.org/ws/2004/08/addressing" 
xmlns:soapl " http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:msc = "http://schemas.microsoft.com/ws/2005/12/wsdl/contract" 
xmlns: wsap= " http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns : wsp= " http://www.w3.org/ns/ws-policy" 
xmlns: wsal "http://www.w3.org/2005/08/addressing" xmlns : wsu = " http://docs-oasis-open.org/wss/2004/01/oasis- 
200401-wss-wssecurity-utility-l. O .xsd" xmlns:iO= "http://schemas.microsoft.com/dynamics/2011/01[services" 
xmlns: wsx= "http://schemas.xmlsoap.org/ws/2004/09/mex" xm Ins : wsdl= "http://schemas.xmlsoap.org/wsdl/" 
targetNamespace="http://tempuri.org/" name="VtvInventoryCustomServicesGroup"> 
<wsp:Policy wsu:Id—"BasicHttpBinding_VtvInventoryCustomServices_poIicy"> 
< wsp: ExactlyOne> 
< wsp : All> 
:TransportBin ding " http://schemas.xmlsoap.org/ws/2005/07/securitypolicy" > 
< wsp:Policy> 
< sp : TransportToken> 
< wsp:Policy> 
<sp:HttpsToken RequireClientCertificate="false"/> 
</wsp: Policy > 
</sp : TransportToken> 
<sp:AlgorithmSuite> 
< Wisp: Policy > 
<sp:Basic256/> 
</wsp: Policy > 
</sp : Algorithm Suite > 
: Layout) 
<wsp:Policy> 
: Strict/> 
</wsp: Policy> 
</sp : Layout) 
</wsp:Policy> 
</sp:TransportBinding> 
</wsp : All> 
</wsp : ExactlyOne> 
</wsp:Policy>

 

Testing open SOAP WSDL in Browser at another computer internet

Example link: https://rd0111796afae4e7df37devaos.cloudax.dynamics.com/soap/services/VtvInventoryCustomServicesGroup?wsdl

 

If result look like screenshot, your service is okie at internet

Topic

Use C# Client connect to SOAP Service to query Item Onhand

 

 

Note: Need to set connection configuration in sample of Microsoft first !

 

15

ServiceSampIes - Microsoft Visual Studio 
File Edit View Project Build Debug Team 
Tools Test 
Any CPU 
Analyze Window Help 
ODataConsoIeAppIication 
Get8indingO 
Quick Launch (Ctrl+Q) 
Start • 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
@ ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
@ SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
ca ODataUtiF 
@ SoapUtiIiO' 
Service References 
properties 
References 
app.config 
packages.config 
SoapHeIper.cs 
emce 
an.bui 
-01 
m ODataChangesetsExampIe.cs 
SoapUtiIlty 
Debug 
SoapHeIper.cs -E X Program.cs 
SoapUtiIlty.SoapHeIper 
[Suslng 
using 
using 
using 
using 
using 
using 
using 
using 
using 
Sy stem; 
System. Collections . Generic ; 
System. Ling; 
System. Net 
System. Net . Security; 
Syst em. Se c u rity. Cryptography. X5ß9Certific ates ; 
System. Setwicemodel; 
System. Servicemodel. Cha n nels ; 
System. Text 
System. Threading. Tasks; 
12 
14 
23 
8 namespace SoapLltiIity 
- 
- 
public class 
SoapHeIper 
public static string 
setwiceName, string aosLlriString) 
var soapSet•'iceLlriStringTempIate = " {a}/ soap/ 
var soapSet•'iceLlriString = string. Format 
(soapSet•'iceLlriStringTempIate, 
aosLlriString. / ' ) , set•'iceName); 
return soapSet•'iceLlriString; 
public 
static 
Binding 
Getainding(

 

Use sample from Microsoft, download at: https://github.com/microsoft/Dynamics-AX-Integration

 

Project: SoapUtility

16

•CRUDExampIes.cs 
Add 
Add Service Reference... 
Add Connected Service 
Scope to This 
New Solution Explorer View 
Copy 
Rename 
Properties 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
@ ODataConsoIeAppIication 
@ PHPConsoIeAppIication 
@ SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
ODataUtiIity 
Service References 
rope les 
References 
app.config 
packages.config 
C* SoapHeIper.cs 
iceTests 
Ctrl+C 
Ctrl* V 
Alt* Enter

 

Add new service references

 

17

Add Service Reference 
To see a list of available services on a specfic server, enter a service URL and click Go. To browse for available 
services, click Discover. 
Address: 
s.clcudax.dvnamics.ccm/sca 
Services: 
VtvInventoyCustomServicesGroup 
Operations: 
Select a service contract to view its operations. 
I service(s) found at address 
https://rdOI 1 1796afae4e7df37devaos.cloudax.dynamics.com/soap/services,fVtvInventoryCustomServicesGro 
up7wsdI'. 
Namespace: 
InventoryCustomServic 
Advanced... 
Cancel

 

Example Link: https://rd0111796afae4e7df37devaos.cloudax.dynamics.com/soap/services/VtvInventoryCustomServicesGroup?wsdl

 

Set name of Namespace, ex: InventoryCustomService

18

SimpleCRUDExampIes.cs 
Build 
Rebuild 
Clean 
Analyze 
Scope to This 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
O DataConsoIeAppIication 
@ PHPConsoIeAppIication 
SoapConsoIeAppIication 
@ TLSConsoIeAppIication 
Utilities 
@ AuthenticationUtiIit,' 
ca ODataUtiIi 
SoapUtiIity 
emce ests

 

Rebuild project SoapUtility

19

Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
ODataConsoIeAppIication 
SoapConsoIeAppIication 
onso pp von 
Utilities 
@ AuthenticationUtiIit,' 
ODataUtiIity 
@ SoapUtiIit,' 
ServiceTests

 

Find project: SoapConsoleApplication

20

SimpleCRUDExampIes.cs 
Build 
Rebuild 
Clean 
Analyze 
Publish... 
Scope to This 
New Solution Explorer View 
Build Dependencies 
Manage NuGet Packages... 
Set as StartUp Project 
Debug 
Initialize Interactive with Project 
Solution Explorer 
Search Solution Explorer (Ctrl+;) 
Solution 'ServiceSampIes' (g projects) 
ConsoleAppIications 
@ JsonConsoIeAppIication 
@ ODataConsoIeAppIication 
PHPConsoIeAppIication 
SoapConsoIeAppIication 
TLSConsoIeAppIication 
Utilities 
AuthenticationUtiIit,' 
ODataUtiIity 
SoapUtiIity 
erviceTests

 

Set as Startup Project for SoapConsoleApplication

21

ODataChangesetsExampIe.cs 
@SoapConsoIeAppIication 
SoapHeIper.cs 
Program.cs 
QueryExampIes.cs 
MetadataDocumentVaIidator.cs 
ODataCIient.tt 
Assemblylnfo.cs 
SimpleCRUDExampIes.( 
SoapConsoIeAppIication.Program 
[Suslng 
uslng 
uslng 
uslng 
uslng 
uslng 
uslng 
Authenticationutility; 
SoapLlt ility. LIS e s s ionSetwiceReferen ce ; 
Sy s tem; 
System. Collection s . Generic ; 
System. Se twi cemodel; 
System. Setwicemodel. Chan ; 
SoapLltiIity. InventoyCustomSet•'ices ; 
[S namespace SoapConsoIeAppIication 
11 
14 
19 
51 
- 
- 
- 
class 
Program 
[STAT hread] 
static vold Main (stringC) args) 
string = 
/ /LlserSessionSer•'ice 
serSessionSet"u'ic 
/ / Inventomßnhandser•'ice 
#region 
InventoyOnhandSet•.'ice 
/ 'Connection 
Set•'iceGroupName — 
"VtvInventoyCustomSetwicesGroup" ; 
ClientConfigu ration . Default. LlriString; 
OAuth Helper. GetAuthentic ationHeader (true) ; 
args) 
aosLlriString) ; 
var 
var 
var 
var 
var 
var 
var 
aosLlriString = 
oauthHeader — 
set•'iceLlriString = SoapUtiIity.SoapHeIper.GetSoapSetwiceUriString(SetwiceGroupName, 
endpointAddress — 
new System. EndpointAddress(setwiceUriString); 
binding = 
client = 
channel 
SoapLltiIity. SoapHeIper. Getainding( ) ; 
new SoapLltiIity.InventoyCustomSer•u'ices .VtvInventoryCustomSerwicesCIient(binding, 
end pointAddress); 
= client. InnerChanneI; 
/ / Call context 
SoapLltiIity. InventoyCustomSet•'ices . Ca IIContext 
ca IIContext — 
ca I Icon text. Compa ny 
"USMF"; 
// Request parameters 
new SoapUtiIity. .CaIIContext(); 
.VtvItemOnhandContract> itemOnhandRequestList = 
/ 'List of requests 
SoapLltiIity. InventoyCustomSer•u'ices . VtvItemOnhandContract 
itenOnhandContract; 
itenOnhandContract = new SoapLltiIity.InventoyCustomSetwices.VtvItemOnhandContract(); 
itemOnhandContract. Itemld = ' 
itemOnha . Wa rehou seld 
itenon ha ndReq uestList. Add ( ha ndContra ct) ; 
itenOnhandContract = new SoapLltiIity.InventoyCustomSetwices.VtvItemOnhandContract(); 
itemOnhandContract. Itemld = ' 
itemOnha . Wa rehou seld 
itemOn h a ndReq uestList . Add ( h a ndContra ct) ; 
new List<SoapUtiIity.

using AuthenticationUtility;

using SoapUtility.UserSessionServiceReference;

using System;

using System.Collections.Generic;

using System.ServiceModel;

using System.ServiceModel.Channels;

using SoapUtility.InventoryCustomServices;

 

namespace SoapConsoleApplication

{

    class Program

    {

        [STAThread]

        static void Main(string[] args)

        {

            string ServiceGroupName = "";

 

            

            //InventoryOnhandService

            #region InventoryOnhandService

            //Connection

            ServiceGroupName = "VtvInventoryCustomServicesGroup";

            var aosUriString = ClientConfiguration.Default.UriString;

 

            var oauthHeader = OAuthHelper.GetAuthenticationHeader(true);

            var serviceUriString = SoapUtility.SoapHelper.GetSoapServiceUriString(ServiceGroupName, aosUriString);

 

            var endpointAddress = new System.ServiceModel.EndpointAddress(serviceUriString);

            var binding = SoapUtility.SoapHelper.GetBinding();

 

            var client = new SoapUtility.InventoryCustomServices.VtvInventoryCustomServicesClient(binding, endpointAddress);

            var channel = client.InnerChannel;

 

            //Call context

            SoapUtility.InventoryCustomServices.CallContext callContext = new SoapUtility.InventoryCustomServices.CallContext();

            callContext.Company = "USMF";

 

            //Request parameters

            List<SoapUtility.InventoryCustomServices.VtvItemOnhandContract> itemOnhandRequestList = new List<SoapUtility.InventoryCustomServices.VtvItemOnhandContract>();

            //List of requests

            SoapUtility.InventoryCustomServices.VtvItemOnhandContract itemOnhandContract;

 

            itemOnhandContract = new SoapUtility.InventoryCustomServices.VtvItemOnhandContract();

            itemOnhandContract.ItemId = "A0001";

            itemOnhandContract.WarehouseId = "24";

            itemOnhandRequestList.Add(itemOnhandContract);

 

            itemOnhandContract = new SoapUtility.InventoryCustomServices.VtvItemOnhandContract();

            itemOnhandContract.ItemId = "A0002";

            itemOnhandContract.WarehouseId = "24";

            itemOnhandRequestList.Add(itemOnhandContract);

 

            using (OperationContextScope operationContextScope = new OperationContextScope(channel))

            {

                HttpRequestMessageProperty requestMessage = new HttpRequestMessageProperty();

                requestMessage.Headers[OAuthHelper.OAuthHeader] = oauthHeader;

                OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestMessage;

 

                SoapUtility.InventoryCustomServices.VtvItemOnhandContract[] itemOnhandArrayRequest = itemOnhandRequestList.ToArray();

                SoapUtility.InventoryCustomServices.getItemOnhandResponse itemOnhandResponse = ((SoapUtility.InventoryCustomServices.VtvInventoryCustomServices)channel).getItemOnhand(

                                                                                                new SoapUtility.InventoryCustomServices.getItemOnhand(callContext, itemOnhandArrayRequest));

 

                SoapUtility.InventoryCustomServices.VtvItemOnhandContract[] itemOnhandArrayResponse = itemOnhandResponse.result;

 

                foreach(VtvItemOnhandContract itemOnhand in itemOnhandArrayResponse)

                {

                    Console.WriteLine();

                    Console.WriteLine("ItemId: {0}, Inventory UnitId: {1}, Warehouse: {2}, Location: {3}, Available On-hand: {4}", 

                                       itemOnhand.ItemId, itemOnhand.InventUnitId, itemOnhand.WarehouseId, itemOnhand.LocationId, itemOnhand.OnHandQty); 

                    

                }

            }

            Console.ReadLine();

 

            #endregion

        }

    }

}

 

 

Write some code as below.

 

Note important code:  

var oauthHeader = OAuthHelper.GetAuthenticationHeader(true);

 

Must to set True in method: GetAuthenticationHeader(true)

22

Itemld : 
Itemld : 
ABBBI , 
ABB82 , 
Inventory Unitld: 
Inventory Unitld: 
Pcs, 
Pcs, 
Warehouse : 
Warehouse : 
24, 
24, 
Location : 
Location : 
Available On-hand: 
Available On-hand: 
178 
18

 

 































  1. Sample Bring your own database (BYOD)

Topic

Create new SQL Azure Database 

 

Step

Screenshot

Description

1

Microsoft Azure 
Azure services 
Create a 
resource 
p Search resources, serrices, and docs (G+/) 
SQL databases 
Firewall 
Manager 
Firewalls 
Storage 
accounts 
Virtual machine 
SQL database 
Subscription 
Storage account 
Storage account 
Azure Active 
Directory 
Virtual 
machines 
Subscriptions 
LAST VIEWED 
3 min ego 
4 min ego 
23 min ego 
17 h ago 
17 h ago 
More services 
Recent resources 
NAME 
devalOd3bf50b-1 
BYODBRD365FO (azuredbrd/BYODBRD365F0) 
Visual Studio Enterprise — MPN 
rd012aa238fb3f017fe8 
dyn047fbfce7586d2e7

 

Go to SQL Database in Azure

2

Microsoft Azure 
Hame > SQL databases > Create SQL Database 
Create SQL Database 
Basics • Networking Additional settings Tags Review + create 
Create a SQL database with your preferred configurations. Complete the Basics tab then go to Review + Create to 
provision With smart defaults, or visit each tab to customize. Learn more 
Project details 
Select the subscription to menage deployed resources end costs. Use resource groups like folders to organize and 
Sarch resources, :€rnc€s, docs (G+/) 
New server 
M Wuoft 
Server name * 
azuredbrd 
an.bui@votivasoft.com 
x 
.database.windows.net 
menage all your resources. 
Subscription * O 
Resource group * O 
Database details 
Visual Studio Enterprise — MPN 
rd01 
Create new 
Server admin login * 
azuredbrd 
Password * 
Confirm password * 
Location * 
(Asia Pacific) Southeast Asia 
Recommended O 
(Asia Pacific) Southeast Asia 
Enter required settings for this database, including picking e logical server end configuring the compute and storage 
resources 
Database name * 
Server * O 
Want to use SQL elastic pool? * O 
3YOD3RD365FO 
Select a server 
Create new 
The value must not be empty. 
O Yes @ No 
Please select a server first. 
Configure cist-bese 
Compute + storage * O 
Review + aeate 
Next : Networking >

 

Create new SQL Database 

Note: Location: Southest Asia

Copy note: Server admin login, Password to use later

3

Microsoft Azure 
Hame > SQL databases > Create SQL Database 
Create SQL Database 
Basics Networking Additional settings Tags Review + create 
Create a SQL database with your preferred configurations. Complete the Basics tab then go to Review + Create to 
provision with smart defaults, or visit each tab to customize. Learn more 
Project details 
Select the subscription to menage deployed resources end costs. Use resource groups like folders to organize and 
menage all your resources. 
Subscription * O 
Resource group * O 
Database details 
Visual Studio Enterprise — MPN 
rd01 
Create new 
Enter required settings for this database, including picking e logical server end configuring the compute and storage 
resources 
Database name * 
Server * O 
Want to use SQL elastic pool? * O 
3YOD3RD365FO 
(new) azuredbrd ((Asie Pacific) Southeast Asia) 
Create new 
O Yes @ No 
Basic 
2 GE storage 
Compute + storage * O 
Review + aeate 
Next : Networking >

 

Change Configure database to Basic 2GB Storage to save money :D

Click Review + Create

4

Microsoft Azure 
Home > SQL databases > Create SQL Database 
Create SQL Database 
Basics Networking 
Product details 
SQL database 
by Microsoft 
Terms of use I Privacy policy 
Terms 
Additional settings 
Tags 
Review + create 
Estimated cost per month 
4.gg 
View pricing details 
By clicking "Create", I (a) agree to the legal terms and privacy statement(s) associated with the Marketplace offering(s) listed (b) 
authorize Microsoftto bill my current payment method for the fees associated With the offering(s), With the same billing frequency as 
my Azure subscription: and (c) agree that Microsoft may share my contact, usage and transactional information with the provider(s) of 
the offering(s) for support, billing and other transactional activities. Microsoft does not prcwide rights for third-party offerings. For 
additional details see Azure Marketplace Terms. 
Basics 
Subscri ption 
Resource group 
Region 
Database name 
Server 
Compute + storage 
Networking 
Allow Azure services and resources to access 
this server 
Private endpoint (preview) 
Additional settings 
use existing data 
Collation 
Advanced data security 
Crea te 
Visual Studio Enterprise— MPN 
(Asia Pacific) Southeast Asia 
8YOD8RD365FO 
(new) azuredbrd 
Basic: 2 GB storage 
No 
None 
Blank 
SQL Latini AS 
Not now 
Download a template for automation

 

Click Create

Topic 

Configure Firewall of SQL Azure database to allow Dynamics D365 FO to connect to SQL

 

5

Microsoft Azure 
Azure services 
Create a 
resource 
p Search resources, serrices, and docs (G+/) 
SQL databases 
Firewall 
Manager 
Firewalls 
Storage 
accounts 
Virtual machine 
SQL database 
Subscription 
Storage account 
Storage account 
Azure Active 
Directory 
Virtual 
machines 
Subscriptions 
LAST VIEWED 
3 min ego 
4 min ego 
23 min ego 
17 h ago 
17 h ago 
More services 
Recent resources 
NAME 
devalOd3bf50b-1 
BYODBRD365FO (azuredbrd/BYODBRD365F0) 
Visual Studio Enterprise — MPN 
rd012aa238fb3f017fe8 
dyn047fbfce7586d2e7

 

Go to SQL database

6

Microsoft Azure 
Home > SQL databases 
SQL databases 
+ Add (D Reservations 
Name 
Edit columns Refresh 
p Search resources, serrices, and docs (G+/) 
Assign tags Delete 
O Try our new Azure SQL resource browser! This experience offers unified view of all your SQL Server resources in Azure as well as improved sorting and filtering. Click here to go to the new 
Subscriptions: Visual Studio Enterprise — MPN — Don't see a subscription? Open Directory + Subscription settings 
Filter by name.„ 
1 items 
BYODBRD365FO 
v 
Server 
azuredbrd 
All locations 
Status 
Online 
All resource groups 
Replication role 
None

 

Click to SQL database

7

SQL databases 
+ Add (D Reservations 
Microsoft Azure 
Hame > SQL databases > BYODBRD365FO (azuredbrd/3YODBRD365F0) 
Name 
Search resources, sernces, and docs (G+/) 
BYODBRD365FO (azuredbrd/BYODBRD365FO) 
SQL 
• More 
COPY O Restore 
Resource group (ch:nG) 
Status 
Location 
Subscription (change) 
Subscription ID 
Tags (change) 
Delete 
Connect with.„ 
Search [Ctrl 
Overview 
Activity log 
Tags 
Diagnose and solve problems 
Quick start 
Query editor (preview) 
Power Platform 
Power 31 (preview) 
PowerApps (preview) 
Flow (preview) 
Settings 
Export 
: rd01 
: Online 
O Set server firewall 
C) Feedback 
Try our new Azure SQL resource 
browser! This experience offers 
unified view of all yur SQL Server 
resources in Azure as well as 
improved sorting end filtering. Click 
here to go to the new experience. 
Filter by name.„ 
BYODBRD365FO 
: Southeast Asia 
: Visual Studio Enterprise— MPN 
. G0620de-87eg-4cd5-90b7-1e1a7313f223 
: Click here to add tags 
: azuredbrd.database.windows.net 
Server name 
Elastic pool 
. No elastic pool 
Connection strings 
: Show database connection strings 
Pricing tier 
: Basic 
Earliest restore point : 
2019-12-10 03:02 UTC 
7 days 
Compute utilization

 

Overview -> Set server firewall

8

Microsoft Azure 
Hame > SQL databases > 8YODBRD365FO (azuredbrd/BYOD8RD365F0) > Firewall settings 
p Search reso 
x 
a seve 
all settings 
Discard Add client IP 
Connections from the IPS specified below provides access to all the databases in azuredbrd. 
Allow Azure services and resources to access this server 
OFF 
Client address 
Rule name 
R001D365FO 
115.78.162.119 
start IP 
13.67.38.125 
End IP 
13.67.38.125 
Connections from the VNET/Subnet specified below provides access to databases in 
azuredbrd. 
Virtual networks 
Rule name 
+ Add existing virtual network 
Virtual netw... Subnet 
+ Create new virtual network 
Address Ran... Endpoint sta... Resource gro... 
Subscription 
No vnet rules for this server.

 

How to find IP of VM D365 FO ?

  1. Find VM in Azure, click to VM

Microsoft Azure 
Azure services 
Create a 
resource 
p Search resources, serrices, and docs (G+/) 
SQL databases 
Firewall 
Menager 
Firewalls 
Storage 
accounts 
SQL database 
Virtual machine 
rage accou 
Storage account 
Azure Active 
Directory 
Virtual 
machines 
Subscriptions 
LAST VIEWED 
5 min ego 
16 h ago 
ego 
17 h ago 
More services 
Recent resources 
NAME 
BYODBRD365FO (azuredbrd/BYODBRD365F0) 
devalOd3bf50b-1 
dyn047fbfce7586d2e7

 

  1. Copy IP

Microsoft Azure 
Home > devalOd3bf50b-1 
deva10d3bf50b-1 
Virtusl 
earch (Ctrl 
p Sarch resources, serrices, and docs (G+,') 
Connect Start Restart D Stop Move Delete Refresh 
O 
'devalOd3bf50b-I' is not using Managed Disks. Migrate to Managed Disks to get more benefits. 
Resource group (change) : rd01 
c 
Security 
Extensions 
Continuous delivery (Preview) 
Availability + scaling 
Configuration 
Identity 
Properties 
Locks 
Export template 
Status 
Location 
Subscription (change) 
Subscription ID 
Computer name 
Operating system 
Size 
Tags (change) 
. Running 
: Southeast Asia 
: Visual Studio Enterprise— MPN 
. G0620de-87eg-4cd5-90b7-1e1a7313f223 
: devalOd3bf50b-1 
: Windows (Windows Server 2016 Datacenter) 
Standard DS12 v2 (4 vcpus, 28 GiB memonj) 
: Click here to add tags 
Azures at 
Public IP address 
: 13.67.38.125 
Private IP address 
: 10.1.14 
Public IP address (IPv6) 
Private IP address (IPv6) : 
Virtual network/subnet 
: rd01-315Gf09/Ax-APPNET-c19351ec 
: rdoldev.southeastasia.cloudapp.azure.com 
DNS name 
Scale Set

 

Create new Rule to access to IP address of VM D365 FO 

Topic

Configure bring your own database in D365

 

9

Finance and Operations 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Production control 
Project management and 
accounting 
Questionnaire 
USMF 
= Standard view 
Options 
Data management 
Import / Export 
Filter 
Run project Load project 
automation 
p data managem 
Dual Write 
Data projects 
p 
All projects 
[2 
Import projects 
J Download 
Delete 
Project type 
Export 
Export 
Import 
Project category 
Project 
Project 
Project 
Templates 
Configure 
entity export to 
database 
Framework 
parameters 
Set up roles for 
data projects 
Configure data 
source 
Data entities 
Staging 
cleanup 
Copy into legal 
entity 
Data project name 
BYOD8 
Export projects 
Integration_Outbound_Flow 01 
Integration-data-project-Ol 
Copy into legal entity 
projects 
Configuration 
Integration 
Other 
CD cf X 
Job history 
All jobs 
Last 24 hours 
Last 3 days 
Last week 
Last month 
Last 3 months 
Last 6 months 
Retail 
Sales an 
eting 
management 
System administration 
Tax 
Time and attendance 
Transportation management 
Vendor collaboration 
Warehouse management

 

Go to System Administration -> Data Management

 

Click Configure entity export to database

10

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Production control 
Project management and 
accounting 
Finance and Operations 
Edit New 
Entity st 
System administration > 
Delete Publish Options 
AX : OPERATIONS 
Workspaces 
Data management 
BYODBRD365FO : BYODBRD365FO 
Source data formats 
Source name 
BYODBRD365FO 
Configure 
Connection string 
Description 
BYODBRD365FO 
Type 
Azure SQL DB 
Default extension 
Validate 
Show 
Create clustered column store Indexes 
Enable triggers in target database

 

How to find connection string of SQL Azure database:

  • Go to SQL Azure database portal

SQL databases 
+ Add (D Reservations 
Microsoft Azure 
Home > SQL databases > BVODBRD365FO (azuredbrd/3YODBRD365F0) - connection strings 
Name 
p Search resources, serrices, and docs (G+/) 
BYODBRD365FO (azuredbrd/BYODBRD365FO) - Connection strings 
SQL 
• More 
Search [Ctrl 
Overview 
Activity log 
Tags 
Diagnose and solve problems 
Quick start 
Query editor (preview) 
Power Platform 
Power 31 (preview) 
PowerApps (preview) 
Flow (preview) 
Settings 
Configure 
Geo-Replication 
Connection strings 
Sync to other databases 
ADO.NET 
JD8C 
ODBC 
Go 
Try our new Azure SQL resource 
browser! This experience offers 
unified view of all yur SQL Server 
resources in Azure as well as 
improved sorting end filtering. Click 
here to go to the new experience. 
Filter by name.„ 
BYODBRD365FO 
ADO.NET (SQL authentication) 
1433,'lnitial C3t31cg= 3YODBRD365FOFersist Security Info-False;user 
= True;TrustServerCertificate = FalseConnection Timeout—3 
Download ADO.NET driver for SQL server

 

Create new one Connection to your SQL Azure Database

Note:

-ConnectionString: Copy from SQL Azure Portal, remember to enter your password to "Password=xxx"

11

Finance and Operations 
System administration > 
Workspaces 
Data management 
Edit New Delete Publish Options 
i Tests completed successfully! 
Entity store I AX: OPERATIONS 
BYODBRD365FO : BYODBRD365FO 
Source data formats 
Source name 
BYODBRD365FO 
Configure 
Connection string 
Description 
BYODBRD365FO 
Type 
Azure SQL DB 
Default extension 
Validate 
Show 
Create clustered column store Indexes 
Enable triggers in target database

 

Validate connection and get message Tests completed successfully

Topic

Publish data entity ready to export

 

12

Finance and Operations 
System administration > 
Workspaces 
Data management 
Edit New Delete Publish Options 
i Tests completed successfully! 
Entity store I AX:OPERATIO S 
BYODBRD365FO : BYODBRD365FO 
Source data formats 
Source name 
BYODBRD365FO 
Configure 
Connection string 
Create clustered column store Indexes 
Enable triggers in target database 
Description 
BYODBRD365FO 
Type 
Azure SQL DB 
Default extension

 

In "Configure entity export to database"

Click Publish

13

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Finance and Operations 
Edit New 
Enable primary table 
Enable entire entity 
Enable custom query 
System administration > Workspaces > Data management 
Delete Publish Drop entity Compare source names Change tracking 
Disable Change Tracking 
USMF 
Options 
i Change tracking will take effect only after the exportjobs have incremental push configured and for the records created after the change 
Tar 
V 
et entities 
8YOD3RD36SFO : BYODBRD365FO 
customers v3 
Published 
No 
Show published only 
Entity 
Customers V3 
Staging table 
CustCustomerV3Staging 
Target entity 
CustCustomerV3Entity 
Entity type Y 
Entity

 

Example: find entity: Customers V3

Change tracking -> Enable entire entity

 

14

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Finance and Operations 
Edit New 
Enable primary table 
Enable entire entity 
Enable custom query 
System administration > Workspaces > Data management 
Delete Publish 
op entity Compare source names Change tracking 
Disable Change rackin 
Options 
i Change tracking will take effect only after the exportjobs have incremental push configured and for the records created after the change 
Target entiti Filter 
customers v3 
Published 
No 
BRD365FO : BYODBRD365FO 
Show published only 
Entity 
Customers V3 
Staging table 
CustCustomerV3Staging 
USMF p 
Successfully published entity 
Customers V3 to 
8YOD8RD36SFO 
Target entity 
CustCustomerV3Entity 
Entity type Y 
Entity

 

Publish entity Customers V3

Topic

Create Export Job to export Customers V3 to SQL Azure database

 

15

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Finance and Operations 
Standard view Options 
System administration 
Workspaces 
Data management 
Import / Export 
Data task 
automation 
Data management 
Dual Write 
Import 
Templates 
Export 
Configure data 
source

 

Go to Export in Data management

16

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Production control 
Project management and 
accounting 
Questionnaire 
Retail 
Sales and marketing 
management 
System administration 
Tax 
Time and attendance 
Transportation management 
Finance and Operations 
Save New Delete 
System administration > Workspaces > Data management 
Export Create recurring data job 
Job history 
U Download 
Applicable roles 
Applicable legal entities 
Generate data package 
Standard view 
USMF 
Manage p 
! This project contains one or more obsolete entities. You may want to replace them. 
p Filter 
Export 
BYODB 
Bring 0365 entity to azure database 
Export 
Integration Outbound Flow... 
Export 
Integration-data-project-Ol 
Asset-Maj o fr Types 
Import 
Export I AX: OPERATIONS 
BYODB : Bring D365 entity to azure database 
Export options 
Group ID 
Export 
Group name 
BYODB 
Description 
Bring D365 entity to azure data... 
Selected entities 
Data project operation type 
Export 
Project category 
Project 
..Ã¥. Add file v 
•F Add template 
{13C25693-CFFF-43F3-8D85-27... 
Resequence Sort by v Disable 
View map Execution unit T Level in executi... 
•b Add entity 
Add multiple v 
Add entity 
JOB DETAILS 
Entity name 
Customers V3 
Open 
(Alt* Down) 
Target data format 
BYOD3RD36SFO 
ource name 
BYODBRD365FO 
ColonSeparated 
ColonSeparated-Unicode 
csv 
CSV-Unicode 
EXCEL 
Ij Remove entity 
Open in Excel 
Sequence Obsolete 
We didn't find anything to show here. 
ype Y 
Operations 
Azure SQL DB 
File 
File 
File 
File 
File

 

Create new one Export job

Data entity: Customers V3

Target data format: <Your own database>

17

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Finance and Operations 
+ New 
p Filter 
BYODB 
System administration > Workspaces > Data management 
Delet 
Expo 
Create recurring data Job 
Job h 
Please 
Bring 0365 entity to azure database 
Export 
Integration Outbound Flow... 
Export 
Export I AX: OPERATIONS 
BYODB : Bring D365 entity 
Export 
Group name 
BYODB 
Selected entities 
Add entity v Add multiple v 
Entity 
Customers V3 
81 
Organization administration 
Integration-data-project-Ol 
Payroll 
Asset-Maj o fr Types 
Import 
Procurement and sourcing 
Product information 
management 
Production control 
Project management and 
accounting

 

Click Export

18

Dynamics 365 v 
Fleet management 
General ledger 
Human resources 
Inventory management 
Master planning 
Organization administration 
Payroll 
Procurement and sourcing 
Product information 
management 
Production control 
Project management and 
accounting 
Questionnaire 
Retail 
Finance and Operations 
View execution log 
System administration > 
Batch job Standard view 
Works paces 
Options 
Data management 
Execution status 
Refresh 
Data export job scheduled. Please refresh 
the form to view current status. 
USMF 
o 
p CD cf 
Execution summary I 
Execution summary :: Export 
Data project name 
BYODB 
Start time 
Entity processing status 
View staging data Y Filter 
Entity 
Customers V3 
Lines 
Headf 
Job ID 
BYODB-2019-12 
End time 
Exported

 

Export job is running

19

Machine generated alternative text:
(9 
Dynamics 365 v 
Finance and Operations 
System administration 
Workspaces 
Data management 
Project category 
Project 
Project 
USMF 
Delete 
Job history 
All jobs 
Last 24 hours 
Last 3 days 
Last week 
Last month 
Last 3 months 
Last 6 months 
p 
Filter 
Data öect name 
BYODB 
ra Ian 
oun 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
Integration-data-project-Ol 
— Execution details 
Pro•ect 
Export 
Impart 
Impart 
Impart 
Impart 
Impart 
Impart 
Impart 
Impart 
Impart 
J Download pi 
Status 
Filter 
Run project Load project 
Standard view Options P 
Data management 
ata proJects 
p 
All projects 
Import projects 
J Download 
Delete 
Project type Y 
Export 
Export 
Data project name 
BYODB 
Export projects 
Integration Outbound 
Copy into legal entity 
projects 
Configuration 
Integration 
Other 
low 01

 

Manage export job

 

Click Execution details

20

Machine generated alternative text:
(9 
Dynamics 365 v 
View execution log 
Finance and Operations 
System administration 
Workspaces 
Data management 
Refresh 
Batch job Standard view Options p 
Execution summary I BYODB-2019-12-10T0341:20-77A994834FA94C6EBOE16S17787A924A 
Execution summary :: Export 
Data project name 
BYODB 
Start time 
12/10/2019 AM 
Entity processing status 
View staging data Filter v 
Entity 
Customers V3 
Execution status 
Succeeded 
With errors: 
Job ID 
BYODB-2019-12-10T03:41. 
End time 
12/10/2019 AM 
Status 
Succeeded 
Exported 
32

 

Export job run succeed

Topic

Check data in SQL Azure database

 

21

Machine generated alternative text:
Microsoft Azure 
Hame SQL databases BYODBRD365FO (azuredbrd/BYODBRD365F0) 
p Search resources, services, and docs (G+/) 
SQL databases 
+ Add (9 Reservations 
Try our new Azure SQL resource 
browser! This experience offers 
unified view of Ell your SQL Server 
resources in Azure es vell 
improved sorting end filtering. Click 
here to go to the new experience. 
Filter by name.„ 
Name 
BYODBRD365FO 
More 
BYODBRD365FO (azuredbrd/BYODBRD365FO) 
O Set server firewall 
Delete 
Connect with.„ 
C) Feedback 
: azuredbrd.database.windows.net 
Server name 
Connection strings 
Show database connection strings 
Pricing tier 
Basic 
Earliest restore p t : 
2019-12-10 03:02 UTC 
Copy Restore 
Resource group (change) 
Status 
Location 
Subscription (change) 
Subscription ID 
Tags (change) 
Export 
: rd01 
• Online 
Search (Ctrl 
Overview 
Activity log 
Tags 
Diagnose and solve problems 
Quick start 
Query editor (preview) 
Power Platform 
1.7 
Power 31 (preview) 
PowerApps (preview) 
Flow (preview) 
Settings 
@ Configure 
Geo-Replication 
Connection strings 
Sync to other databases 
A Add Azure Search 
Properties 
e Locks 
Export template 
• Southeast Asia 
Visual Studio Enterprise — MPN 
• c.0620de-87eg-4cds-90b7-1e1a7313f223 
: Click here to add tags 
File 
Microsoft SQL Server Management Studio 
Edit View Project Tools Window Help 
Connect to Server 
Server tyiW 
Authentication: 
Object Explorer 
Connect • 
SQL Server 
azuredbrd databasewindows net 
SQL Server Authentication 
azuredbrd 
Rememt»r passvord 
Connect 
Options

 

Use SQL Server Management Studio

Connect to SQL Azure database with user and pass

22

Machine generated alternative text:
File 
Microsoft SQL Server Management Studio 
Edit View Project Tools Window Help 
Object Explorer 
Connect • 
New Firewall Rule 
Conne 
Ywr client IP address not have access to the server. in to 
an Azure account end create a new firm•all rule to enable access 
to Wcr0s0ft Azure 
Sign In.. 
Name 
• Add my client IP address 
11578162119 
Add my subnet IP address range 
From 
To 113781622%

 

Sign in with email account

23

Machine generated alternative text:
Sign in to your account 
Microsoft 
Pick an account 
An Bui 
an.bui@votivasoft.com 
Connected to Windows 
Phuoc Dinh 
phuoc.dinh@ phatgroup.com 
Connected to W.ndo•ws 
Tri Ho 
tri-ho@phuongphatgroup.com 
Connected to Windows 
admin@vietthuongmusic.onmicrosoft. 
Use another account 
Terms Of 
x 
PrrvKy & cookies

 

Input Email account

24

Machine generated alternative text:
New Firewall Rule 
Conne 
YIM client IP address dws have access to the server Sign in to 
en Azure account end create a rule to enable access. 
You are in 
Firmven rule 
Add my client IP address 
C) Add my subnet IP address range 
Frorn 113781620 
C ha nqe user 
11578162235 
To

 

Click OK

25

Machine generated alternative text:
File 
SQLQuery1 sql • azuredbrd.database.windows.netBYODBRD365FO (azuredbrd (143))' • Microsoft SQL Server Management Studio 
Edit View 
Query Project Tools Window Help 
•y 3WDBRD365FO 
Quick Launch (Ctrl•Q) 
PRIMARYCONTACTPHONEPURPOSE PRIMARYCONTACTTELEXPURP 
SQLQueryI.sqI - az...O (azuredbrd (143))• x 
/ Script for SelectTopNRows comand from SSMS 
—SELECT 
FROM LdboJ . LCustCustomerV3StagingJ 
110% 
Results Messages 
Object Explorer 
Connect • 
azuredbrd.database.windovvs.net (SQL Serve 
Databases 
System Databases 
BYOD8RD365FO 
Database Diagrams 
Tables 
System Tables 
Ee External Tables 
GraphTables 
dboCustCustomerV3Staging 
Efl Views 
External Resources 
Efl Synonyms 
Programmability 
Security 
Integration Services Catalogs 
ADDRESSLOCATIONROLES 
Oel 
Oel 
Oel 
12 
13 
14 
16 
17 
18 
19 
20 
21 
22 
23 
24 
25 
26 
PARTYTYPE ADDRESSBOOKS 
Retai Cwt 
Retw Cwt 
Retai 
Retw Cwt 
Retai 
Rew Cwt 
Retai 
Org-WI 
Org-WI 
Org-MI 
Org-MI 
Org-MI 
Org-MI 
Org-MI 
Org-WI 
Org-WI 
Org-WI 
PRIMARYCONTACTEMAILPURPOSE PRIMARYCONTACTFAXPURPOSE

 

You can see tables which were publised in D365 FO

26

[Optional]

Machine generated alternative text:
File 
Microsoft SQL Server Management Studio 
Edit View Project Tools Window Help 
Object Explorer 
Connect • 
E azuredbrd.database.windows.net (SQL St 
Databases 
System Databases 
BYODBRD365FO (expanding„) 
Database Diagrams 
• Tables 
Efl Views 
Efl External Resources 
Efl Synonyms 
programmability 
Security 
Integration Services Catalogs 
Microsoft SQL Server Management Studio 
Cannot open server •azuredbrd' requested by the login. Client with IP address '14.161.222 is not 
allowed to access the server. To enable access, use the Windows Azure Management or run 
sp_set_firewall_rule on the master database to create a firewall rule for this IP address or address 
range. It may take up to five minutes for this change to take effect. (Microsoft SQL Server, Error. 
40615) 
Help •b Copy message Show details

 

If you get this error , you need to set firewall rule for new IP address access to SQL Azure database

27

Machine generated alternative text:
Microsoft Azure 
Hame SQL databases BYODBRD365FO (azuredbrd/BYODBRD365F0) Firewall settings 
Firewall settings 
(SQL 
Save X Discard Add client IP 
Connections from the IPS specified below provides access to Ell the databzses in azuredbrd. 
Allow Azure services and resources to access this server 
End IP 
115.78.162.119 
118.69.74.13 
13.67.38.125 
14.161.22.2 
OFF 
Client IP address 
Rule name 
ClientlPAddress 2019-12-10... 
ClientlPAddress 2019-12-10... 
Votiva03 
start IP 
115.78.162.119 
118.69.74.13 
13.67.38.125 
14.161.22.2 
Connections from the VNET,'Subnet specified below provides access to databases in 
azuredbrd.

 

Configure firewall of SQL Azure database to allow new IP Address


No comments:

Post a Comment