Dynamics CRM Web API C# Auto Refresh Access Token while performing API request to CDS


Dynamics CRM's avatarxrm CRM Dynamics

As we know to connect to CDS WEB API from C# application we first need to acquire access token and validity of that is 1 hour. While performing small number of requests this will be sufficient. However when we want to run long running process we will get HTTP 400 error when token expires.

To overcome this issue, The recommended approach is to implement a class derived from DelegatingHandler which will be passed to the constructor of the HttpClient. This handler will allow you to override the HttpClient.SendAsync method so that ADAL will call the AcquireToken method with each request sent by the http client.

Step – 1

Create new class in your project and add below code.

/// <summary> ///Custom HTTP message handler that uses OAuth authentication through ADAL. /// </summary> class OAuthMessageHandler : DelegatingHandler { private UserCredential _credential; private AuthenticationContext _authContext = new AuthenticationContext("https://login.microsoftonline.com/common", false); private string _clientId…

View original post 394 more words

Extend access token lifetime


Send bulk email / direct email to Customers – Dynamics 365


To enable the option of sending bulk email / direct mail in Unified Interface, we can navigate to Settings >> Administration >> System Settings >> Email >> Enabled Send Direct Email Action in Unified Interface

Now on selecting the record(s) of email enabled table, we get the option “Send Direct Email”

We can also specify the Email Template and preview the content before sending.

We can see the mail received in the Hotmail account from the CRM user’s email id/mailbox configured.

Here the end-user has also replied to the email.

We can see the response / reply automatically “Tracked to Dynamics 365” in the CRM user’s outlook. (based on the CRM user’s Personal Options setting)

Which creates Email activity (closed status) in the corresponding contact record inside CRM.

More on Tracking Email

Hope it helps..

Advertisements

Fixed – This assets-oce.mkt.dynamics.com page can’t be found in Dynamics 365 Marketing


Recently we got the below error while trying to open the files in our Real-time marketing Assets Library.

We raised the Microsoft Support ticket for this and got the issue fixed.

This was because our environment was in Admin mode. (as we were going live so had kept it in admin mode, till we verify it), and there are specific tasks related to processing marketing content, such as resizing image / optimizing image / etc. that requires some Async Service to run in the background which needs the environment to be in the non-admin mode.

Disabling the Admin mode for the environment fixed it.

Hope it helps..

Advertisements

Fixed – We can’t find the form page you’re trying to load – Dynamics 365 Marketing


Recently we saw the below error in one of our marketing forms hosted on the website –

We can’t find the form page you’re trying to load: <div data-editorblocktype=”FormBlock” data-form-block-id=”64d87bc7-279d-ed11-aad1-00224814fd52″></div>. Please check your page setup.


This occurs if the form is not Live.


Making the form “Go live” will fix the issue.


Hope it helps..

Advertisements

Fixed – The domain where this form is embedded might not be enlisted as a domain record for externally hosted forms in Dynamics 365 Marketing


Recently we were getting the below issue for our Marketing Forms hosted on an external website on a particular authenticated domain. The pages were working fine in other authenticated domains.

The domain where this form is embedded might not be enlisted as a domain record for externally hosted forms. Otherwise, a browser extension or plugin may be blocking this form from loading. Review and reload form to continue.”

This particular domain was also shown as authenticated in our Dynamics 365 marketing.

Our website was e.g. https://www.domain.kiwi/ so we had domain.kiwi authenticated in Dynamics 365 Marketing.

Eventually, we had to raise a Microsoft Support Ticket and were instructed to add/ authenticate www.domain.kiwi   (with www.) also, doing so resolved the issue for us.

Also, there seemed like a UI bug in the Marketing which will cut out “www.” automatically when trying to authenticate the domains.

Hope it helps..

Advertisements

Nishant Rana's Weblog

Everything related to Microsoft .NET Technology

Skip to content ↓