web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Create Lead record from ASP.NET app

(0) ShareShare
ReportReport
Posted on by

I'm trying to connect my custom ASP.NET app to Dynamics 365. On a form submit, the app should create a new Lead record in Dynamics. The app doesn't need to have users authenticated into CRM. I probably just need one default user which will take the form submit data and insert it into CRM.

My first attempt was to register an Azure app in Active Directory and add it's ID into my ASP.NET app so that it can connect to Dynamics. After the registration I tried to give it all possible permissions so that I can at least make it talk to Dynamics but it still had problems. I tried both Native and Web app, as shown in the screenshot.

But now I'm wondering if this is the way to go or am I way off?

KYS.png

*This post is locked for comments

I have the same question (0)
  • Clem Profile Picture
    2,541 on at

    Hello,

    Why don't you just use the SDK on your asp.Net site to parse the data submitted from your form and reuse it with the proper cast to create the record ?

    With some reflection you can easily rework the casting and you are then good to go.

    Clément

  • Suggested answer
    SavvyLuke Profile Picture
    655 on at

    Micho,

    Give this link a try: http://colinvermander.com/2017/03/29/building-a-dynamics-365-asp-net-web-app-with-adoxio-connect-framework/

    It should help you get started.

  • Community Member Profile Picture
    on at

    My problem though is how to connect my app to Dynamics to insert the data. Do you have any tutorial how to use this SDK you are referring or the name of the SDK?

  • Suggested answer
    Aric Levin - MVP Profile Picture
    30,190 Moderator on at

    You will need add References to the Microsoft.Xrm.Sdk and Microsoft.Xrm.Tooling.Connector to your application, and have logic for connecting to your CRM environment. Within your asp.net application you have a couple of options to connect:

    // add the following in the Using section:

    using Microsoft.Xrm.Tooling.Connector;

    private IOrganizationService service;

    // Connect Using Connection String

    CrmServiceClient conn = new CrmServiceClient(connectionString);

    // Connect Using Credentials

    NetworkCredential creds = new NetworkCredential(userName, ConvertToSecureString(CRM_PASSWORD));

    AuthenticationType authType = AuthenticationType.Office365;

    CrmServiceClient conn = new CrmServiceClient(userName, ConvertToSecureString(CRM_PASSWORD), "NorthAmerica", orgName, isOffice365: true);

    // After creating the connection, you will need to map it to the Organization Service:

    service = (IOrganizationService)conn.OrganizationWebProxyClient != null ? (IOrganizationService)conn.OrganizationWebProxyClient : (IOrganizationService)conn.OrganizationServiceProxy;

    // You can use the following function to ConvertToSecureString

           private static System.Security.SecureString ConvertToSecureString(string password)

           {

               if (password == null)

                   throw new ArgumentNullException("missing pwd");

               var securePassword = new System.Security.SecureString();

               foreach (char c in password)

                   securePassword.AppendChar(c);

               securePassword.MakeReadOnly();

               return securePassword;

           }

    Once you have the connection you can manipulate the CRM entities to create/retrieve information.

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans