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)

ASP.NET Application to consume OData URL output and present data

(0) ShareShare
ReportReport
Posted on by 205

Does any one have came across any project/code to Create ASP.NET Application with Gridview to display CRM data using Dynamics CRM OData URL??

I try to create simple asp.net application using visual studio with simple JQuery syntax like below, but for some reason this does not work. If i create simple HTML page using NotePad++ and use this code, it works.

Any idea what am i doing wrong or do i need to pass any authetication token when i use visual studio or any thing else??

    $.ajax({
            type: "GET",           
            datatype: "json",
            data:"{}",
            crossDomain: true,
            beforeSend: function (XMLHttpRequest) {
                //debugger;
                XMLHttpRequest.setRequestHeader("Accept", "application/json");
                XMLHttpRequest.setRequestHeader("Content-type", "application/json; charset=utf-8");
                //debugger;
            },
            url: "testserver/.../OpportunitySet$select=CreatedOn,EstimatedCloseDate,Name,OpportunityId",
            async: false,
            success: function (data, textStatus, xhr) { debugger; alert(data); },
            error: function (xhr, textStatus, errorThrown) {
                debugger;
                alert(textStatus + " " + errorThrown);
            }
        });

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    MSDN article (CRM 2015): msdn.microsoft.com/.../gg695790.aspx

    Blog post (CRM 2011): lakshmanindian.wordpress.com/.../update-selected-records-in-home-page-entity-grid-in-crm-2011

    If you're pulling data from CRM on-premise, try using a CRM Online instance instead.

    Troubleshooting tips for points of failure:

    (1) AJAX query: use Fiddler to isolate issue in WCF call

    (2) Binding: use early-bound types

    Are you using your own WCF data service?

  • Nicksoft Profile Picture
    205 on at

    I wants to use OData URL and get the databack....and display it. I di it using CRM SDK utilities, but i think if we know the URL, then it might be easy to call the javascript and get teh data. can you assist whether it is possible using OData URL in javscript from ASP.NET Web Application??

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

                     What error does it display when you try to use this code in Asp.NET??

    Best Regards

    Shah

  • Nicksoft Profile Picture
    205 on at

    2015_2D00_10_2D00_09_5F00_7_2D00_32_2D00_29.jpg

    I heard that CORS is not supported with Dynamics CRM at this moment yet, so in order to Grab CRM data within visual studio, we have to reference CRM Proxy WebService. It will not work with JavaScript/OData directly.  Once New Web API come in place, then it will enable CORS and then it will be supported.

    Please share your thoughts on this discussion.

  • Nicksoft Profile Picture
    205 on at

    Any assistance on these feature of CRM guys??? I think there are lots of potential on this technology if we can consume OData right in visual studio without adding service reference proxy....

  • Community Member Profile Picture
    on at

    Such a feature would be very useful to us as well. Even the CRM 2015 web api preview doesn't seem to be CORS enabled. Other services like Office 365 api's or the SharePoint files API are working. It would be unfortunate if for the CRM service we are required to do additional server side coding.

    Especially since Adal-AngularJS already facilitates authentication against  all these services.

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