Today, We will show you how to create OData web services for Microsoft Dynamics GP to consume with Microsoft Power Platform Custom Connector.
Open Visual Studio.
Create New Project.
Select Web API and Create.
Add ADO .NET Entity Data Model.
Specify the Name of the Item.
Select EF Designer
Create New Connection with your SQL Server where your Dynamics GP Database exist.
Enter Server Name.
Select SQL Server Authentication.
Enter Credentials for your SQL Server.
Select your database name.
Afterwards, test your connection.
Click OK.
Set settings for now like below and Click Next.
Choose Entity Framework 5.0 and Click on Next.
Choose tables and click on finish.
Now, Build Your Solution.
Add Controller.
Select Web API OData v3 Controller with actions, using Entity Framework.
Now copy these lines and paste them into WebApiConfig.
using System.Web.Http.OData.Builder;
using System.Web.Http.OData.Extensions;
using odatacustomconnector.Models;
And on the method, paste these lines of code. We are using only one entity, you can add more according to your need.
ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
builder.EntitySet<PM00200>(“PM00200”);
config.Routes.MapODataServiceRoute(“odata”, “odata”, builder.GetEdmModel());
Your WebApiConfig file code looks like below
Now, Play the app and check the odata url.
So, you can publish your app and consume OData web services to create a Custom Connector and start to play with the PowerApps app.