Skip to main content
Dynamics 365

Currency Exchange Rates from RSS

An often requested feature is automatic download of currency exchange rates, and this short article illustrates how you can build your own using RSS feeds and MS XMLDOM 6.0 which should work with all NAV versions 2.0 to 2009R2. Going forward, you should consider using DotNet types instead.

There are a lot of RSS feeds out there, some free and some not. The basis of all of them is that you can simply load them into an xml document and parse the data from there. The good news is that the RSS format is standardized. The bad news is that every RSS feed provider has a lot of freedom to specify the data as they choose. Therefore we will just look at one example using Yahoo, and you may build your own from there.

If you download the rss feed and save it as an xml file, you get a layout similar to this:

<?xml version=”1.0″?>

<rss version=”2.0″ xmlns:geo=”http://www.w3.org/2003/01/geo/wgs84_pos#” xmlns:content=”http://purl.org/rss/1.0/modules/content/” xmlns:media=”http://search.yahoo.com/mrss/” xmlns:yt=”http://gdata.youtube.com/schemas/2007“>

  <channel>

    <title>USD Exchange Rates</title>

    <description>Grabs USD exchange rates from Yahoo Finance and outputs as RSS feed.</description>

    <link>http://pipes.yahoo.com/pipes/pipe.info?_id=_kHVIdZ13hGXgt1VwmH_9A</link>

    <pubDate>Mon, 18 Apr 2011 07:55:57 +0000</pubDate>

    <generator>http://pipes.yahoo.com/pipes/</generator>

    

      <item>

        <title>AED</title>

        <description>3.6729</description>

        <guid isPermaLink=”false”>1</guid>

        <pubDate>Mon, 18 Apr 2011 09:00:00 +0000</pubDate>

      </item>

      <item>

        <title>AFN</title>

        <description>43.00</description>

        <guid isPermaLink=”false”>2</guid>

        <pubDate>Mon, 18 Apr 2011 10:53:00 +0000</pubDate>

      </item>

And so on…

The task is then just to parse the information.

I have attached two objects in text format, table 50000 and codeunit 50000 that illustrate how you might implement some code that parses the input and updates the currency exchange rate table.

NOTE!! The code is sample code and serves only the purpose of illustration and cannot be guaranteed to work or to be correct, and Microsoft does not take any responsibility in how the code is utilized. Furthermore, there may be legal or financial responsibilities in utilizing a particular RSS feed, and the use of Yahoo’s RSS feed is only one example.