{"id":629,"date":"2010-10-02T20:53:43","date_gmt":"2010-10-03T03:53:43","guid":{"rendered":"http:\/\/45.63.48.66\/?p=629"},"modified":"2019-05-02T14:54:01","modified_gmt":"2019-05-02T21:54:01","slug":"repost-dynamics-nav-and-the-rot-table","status":"publish","type":"post","link":"https:\/\/gotcal.com\/index.php\/2010\/10\/repost-dynamics-nav-and-the-rot-table\/","title":{"rendered":"Repost: Dynamics NAV and the ROT Table"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-638\" title=\"topsecret\" src=\"\/wp-content\/uploads\/2010\/10\/topsecret.jpg\" alt=\"\" width=\"252\" height=\"200\">After switching blogging software, due to a server crash i never really got the old posts reposted from the original blog. I have had a lot of requests for one particular post: Dynamics NAV and the ROT table. I started finding the old backup of the database, to restore the post and realized it is almost 3 years old. Cant believe how fast times goes by. But after reading the very interesting post from Waldo about their new tool ReVision i came to think of this old post. (unfortunately i will not be at Directions in San Diego myself, even though i just live a couple of hours from there! But i hope to get some updates from people seeing the tool demonstrated!).<\/p>\n<p>Basically what the post was about was the features of Rolling Object Table, a feature that allows Windows programs to publish &#8220;interfaces&#8221; to some of it internal features &#8211; i dont know it this is the correct description of it though :). Dynamics NAV is exposing some methods to read\/write objects through the client, as well as querying forms and getting other data from the client. Since my original post, there has been quite a few additional blogs featuring the technology. We (see kudos section at the bottom) were playing around with the .NET Reflector tool, and used it on one of Celenia Version Controls dll&#8217;s. I had the same features as used in the Developers Toolkit for importing\/exporting objects from the running client.<\/p>\n<p><!--more--><\/p>\n<p>Here are some of the latest blog posts about the subject, that will give you much more information:<\/p>\n<ul>\n<li><a href=\"http:\/\/dynamicsuser.net\/blogs\/waldo\/archive\/2010\/10\/02\/source-control-for-microsoft-dynamics-nav-revision.aspx\">ReVision Source control for Dynamics NAV by iFacto (Waldo)<\/a> &#8211; See the videos they have posted about the ease of setup and integration. &#8211; update October 4: <span style=\"color: #ff0000;\">Confirmed by Eric Waulters (Waldo) that they use the functionality!<\/span><\/li>\n<li><a href=\"http:\/\/mibuso.com\/dlinfo.asp?FileID=1193\">Navision Automation Library by Dick Marinus on mibuso.<\/a> &#8211; great little automation library that can be used with powershell and Autoit script language, has a lot of interfaces available.<\/li>\n<li><a href=\"http:\/\/mibuso.com\/dlinfo.asp?FileID=1153\">NAV pluing for TFS Source Control<\/a> &#8211; not sure if this project is still alive, used to be on <a href=\"http:\/\/dynamicsplanet.com\">http:\/\/dynamicsplanet.com<\/a><\/li>\n<li><a href=\"http:\/\/mibuso.com\/dlinfo.asp?FileID=1088\">NAV autoupdate through C#<\/a><\/li>\n<\/ul>\n<p>Here is the original post from December 2007:<\/p>\n<p>With the introduction of hyperlinks for the  Dynamics NAV client, the approach taken was the Running Object Table  (ROT Table). From the <a href=\"http:\/\/web.archive.org\/web\/20080316224530\/http:\/\/msdn2.microsoft.com\/en-us\/library\/ms695276.aspx\">http:\/\/msdn2.microsoft.com\/en-us\/library\/ms695276.aspx<\/a> article:  &#8220;The most common type of moniker provider is a compound-document link  source. This includes server applications that support linking to their  documents (or portions of a document) and container applications that  support linking to embeddings within their documents.&#8221;<\/p>\n<p>Im not a  wizard in to this, and it has been a lot of googling for the  information, so if you have additional information on this issue, any  hints and information would be very helpful.<\/p>\n<p>Where do we find information about the interfaces? In the registry, take a look at this key:<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/registryentries_50000004.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-630\" title=\"registryentries_50000004\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/registryentries_50000004.png\" alt=\"\" width=\"630\" height=\"325\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/registryentries_50000004.png 630w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/registryentries_50000004-300x154.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Here are the some class names from the registry:<\/p>\n<ol>\n<li>INSHyperlink<\/li>\n<li>INSObjectDesigner<\/li>\n<li>INSApplication<\/li>\n<li>INSForm<\/li>\n<li>_INSApplicationEvents<\/li>\n<li>INSHook<\/li>\n<li>INSTable<\/li>\n<li>INSRec<\/li>\n<li>INSMenuButton<\/li>\n<li>_INSMenuButtonEvents<\/li>\n<li>INSAppBase<\/li>\n<li>INSCallbackEnum<\/li>\n<\/ol>\n<p>For  now i have only been able to find Interfaces to INSObjectDesigner (as  they are used in Celenia Version Control), which of course is very  interesting. It exposes methods for these functions:<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/vstudio.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-631\" title=\"vstudio\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/vstudio-1024x854.png\" alt=\"\" width=\"600\" height=\"500\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/vstudio-1024x854.png 1024w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/vstudio-300x250.png 300w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/vstudio.png 1101w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>But where is the &#8220;documenation&#8221; on these interfaces??????<\/p>\n<p>The  format for the Read and Write functions are text files, like the ones  that can be imported\/exported through the object designer.<\/p>\n<p>Currently  i have created small installers for code dropping into NAV objects,  that uses the ReadObject, then parses the file, and inserts the code,  and finally imports back into NAV with WriteObjects.<\/p>\n<p>Here is some  screenshots from a simple application reading objects into a texteditor,  allows editing, and then writing back to NAV:<\/p>\n<p>Step 1: Read object into editor<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit0.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-632\" title=\"edit0\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit0.png\" alt=\"\" width=\"630\" height=\"338\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit0.png 630w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit0-300x160.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Step 2: Find documentation trigger<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit1.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-633\" title=\"edit1\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit1.png\" alt=\"\" width=\"630\" height=\"338\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit1.png 630w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit1-300x160.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Step 3: Add text<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit2.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-634\" title=\"edit2\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit2.png\" alt=\"\" width=\"630\" height=\"338\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit2.png 630w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit2-300x160.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Step 4: Write back to NAV<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit3.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-635\" title=\"edit3\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit3.png\" alt=\"\" width=\"630\" height=\"338\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit3.png 630w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit3-300x160.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>Step 5:&nbsp;Code changed in NAV<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit4.png\" rel=\"lightbox[629]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-636\" title=\"edit4\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/10\/edit4.png\" alt=\"\" width=\"630\" height=\"253\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit4.png 630w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/10\/edit4-300x120.png 300w\" sizes=\"auto, (max-width: 630px) 100vw, 630px\" \/><\/a><\/p>\n<p>So  currently im interested in finding information about the other  interfaces. I will continue this series of post here when i get some  decent frameworks done in .NET. Perhaps making a Dynamics NAV Installer  project in the open source community would be interesting, what do you  think?<\/p>\n<p>Other resources:<\/p>\n<p><a href=\"http:\/\/web.archive.org\/web\/20080316224530\/http:\/\/www.codeproject.com\/KB\/cs\/automatingvisualstudio.aspx\">http:\/\/www.codeproject.com\/KB\/cs\/automatingvisualstudio.aspx<\/a><br \/>\n<a href=\"http:\/\/web.archive.org\/web\/20080316224530\/http:\/\/www.mibuso.com\/dlinfo.asp?FileID=776\">http:\/\/www.mibuso.com\/dlinfo.asp?FileID=776<\/a><\/p>\n<p>Not to forget, kudo&#8217;s go out to Claus Hornb\u00e6k,&nbsp;Alexey Pavlov&nbsp;and Lutz Roeder.<\/p>\n<h1>GotCAL.CSideInstaller Source<\/h1>\n<p>Monday, March 24, 2008 by Administrator<\/p>\n<p>(note this is a post in progress, please post comments etc.)<\/p>\n<p>This is the second part of Dynamics NAV and the ROT Table, which was posted in december 2007. In this article i will discuss some of the uses of the interfaces, and also give give you access to the sourcecode for a simple application created in Visual Studio 2005.<\/p>\n<p>First off let&#8217;s take a look at the Interface for the NSObjectDesigner class:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nIObjectDesigner.cs:\nnamespace GotCAL.CSIDEInstaller\n{\nusing System;\nusing System.Runtime.InteropServices;\nusing System.Runtime.InteropServices.ComTypes;\n&#x5B;ComImport, Guid(&quot;50000004-0000-1000-0001-0000836BD2D2&quot;), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]\ninternal interface IObjectDesigner\n{\n&#x5B;PreserveSig, DispId(1)]\nint ReadObject(&#x5B;In] int objectType, &#x5B;In] int objectId, &#x5B;In] IStream destination);\n\n&#x5B;PreserveSig, DispId(2)]\nint ReadObjects(&#x5B;In] string filter, &#x5B;In] IStream destination);\n\n&#x5B;PreserveSig, DispId(3)]\nint WriteObjects(&#x5B;In] IStream source);\n\n&#x5B;PreserveSig, DispId(4)]\nint CompileObject(&#x5B;In] int objectType, &#x5B;In] int objectId);\n\n&#x5B;PreserveSig, DispId(5)]\nint CompileObjects(&#x5B;In] string filter);\n\n&#x5B;PreserveSig, DispId(6)]\nint GetServerName(out string serverName);\n\n&#x5B;PreserveSig, DispId(7)]\nint GetDatabaseName(out string databaseName);\n\n&#x5B;PreserveSig, DispId(8)]\nint GetServerType(out int serverType);\n\n&#x5B;PreserveSig, DispId(9)]\nint GetCSIDEVersion(out string csideVersion);\n\n&#x5B;PreserveSig, DispId(10)]\nint GetApplicationVersion(out string applicationVersion);\n\n&#x5B;PreserveSig, DispId(11)]\nint GetCompanyName(out string companyName);\n}\n}<\/pre>\n<p>as you can see we import the COM library, which we discovered in the registry. In the registry it shows it has 14 methods, so far i only know 11 of them. These were found using reflection on the Celenia Version Control software, and it is also the way (i guess!) the Developers Toolkit can extract the ojbects through the CSide Client.<\/p>\n<p>Most of the methods are very simple, and just return a string, and thus they are very easy to implement, eg.:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\npublic string GetDatabaseName()\n{\nstring databaseName;\nint num = this._objectDesigner.GetDatabaseName(out databaseName);\nreturn databaseName;\n}<\/pre>\n<p>As most of you who have been playing around with this after the first post have discovered the biggest issue, is reading and writing the streams that holds the actual objects. At first I used &#8220;AuthHelper.dll&#8221; a library that somehow could handle the reading and writing of streams. But here is a StreamSupport class that handles it in .NET:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nnamespace GotCAL.CSIDEInstaller\n{\nusing System;\nusing System.IO;\nusing System.Runtime.InteropServices.ComTypes;\n\npublic class StreamSupport\n{\npublic static unsafe IStream ToIStream(Stream stream, ref IStream comStream)\n{\n\nbyte&#x5B;] buffer = new byte&#x5B;stream.Length];\nstream.Read(buffer, 0, buffer.Length);\nuint num = 0;\nIntPtr pcbWritten = new IntPtr((void*) &amp;amp;num);\ncomStream.Write(buffer, buffer.Length, pcbWritten);\nreturn comStream;\n}\n\npublic static unsafe MemoryStream ToMemoryStream(IStream comStream)\n{\nMemoryStream stream = new MemoryStream();\nbyte&#x5B;] pv = new byte&#x5B;100];\nuint num = 0;\nIntPtr pcbRead = new IntPtr((void*) &amp;amp;num);\ndo\n{\nnum = 0;\ncomStream.Read(pv, pv.Length, pcbRead);\nstream.Write(pv, 0, (int) num);\n}\nwhile (num &amp;gt; 0);\nreturn stream;\n}\n}\n}<\/pre>\n<p>Hope to get some feedback from all you out there, please post a comment, idea, or just a quick hello.<\/p>\n<p>Download the sample application here.<\/p>\n<p>[dm]12[\/dm]<\/p>\n<p>Here are some of the old comments for the blog posts:<\/p>\n<ol>\n<li id=\"comment-1135\"><cite><a rel=\"external nofollow\" href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx\">Ryan<\/a><\/cite> Says:<br \/>\n<small><a href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx#comment-1135\">Wednesday, January 23, 2008<\/a><\/small>Dude ! You rock !<\/p>\n<p>I have looked briefly at this&#8230; But am struggling&#8230;<\/p>\n<p>Any chance of an example of linking the dll into the c# ?<\/li>\n<li id=\"comment-1134\"><cite><a rel=\"external nofollow\" href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx\">Tim<\/a><\/cite> Says:<br \/>\n<small><a href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx#comment-1134\">Tuesday, January 08, 2008<\/a><\/small>Interesting  concept, I have been looking for something like this, would it be  possible to get a copy of your source code for testing.<\/p>\n<p>Thanks,<br \/>\nTim<\/li>\n<li id=\"comment-1133\"><cite><a rel=\"external nofollow\" href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx\">Attie Retief<\/a><\/cite> Says:<br \/>\n<small><a href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx#comment-1133\">Monday, January 07, 2008<\/a><\/small>Just what I&#8217;ve been looking for &#8211; I would LOVE your sample code&#8230;any chance of sending it?<\/p>\n<p>Thanks<br \/>\nAttie<\/li>\n<li id=\"comment-1131\"><cite><a rel=\"external nofollow\" href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx\">Alex<\/a><\/cite> Says:<br \/>\n<small><a href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx#comment-1131\">Sunday, December 23, 2007<\/a><\/small>I found it very interesting.<\/p>\n<p>I think that there is no public documentation for the interfacs because  Microsoft designedly wipe out all typelib information from dll. But you  can make a reverse engeniiring of NSObjectXProxy.dll. It should contains  list of methods and arguments for the interfaces.<\/p>\n<p>Why don&#8217;t share the results of your research with the community?<\/li>\n<li id=\"comment-1125\"><cite><a rel=\"external nofollow\" href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx\">Tommy Olesen<\/a><\/cite> Says:<br \/>\n<small><a href=\"http:\/\/web.archive.org\/web\/20080212172831\/http:\/\/45.63.48.66\/2007\/12\/10\/dynamics-nav-and-the-rot-table.aspx#comment-1125\">Wednesday, December 12, 2007<\/a><\/small>Thats sooo cool. Can you send me a copy of the .NET code for your little application?<\/p>\n<p>Thanks!<br \/>\nTommy<\/li>\n<\/ol>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>After switching blogging software, due to a server crash i never really got the old posts reposted from the original blog. I have had a lot of requests for one particular post: Dynamics NAV and the ROT table. I started finding the old backup of the database, to restore the post and realized it is [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,49],"tags":[37,30,77,28,38,22,41],"class_list":["post-629","post","type-post","status-publish","format-standard","hentry","category-navision","category-repost","tag-application","tag-automation","tag-navision","tag-external","tag-guide","tag-object","tag-tools"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/629","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/comments?post=629"}],"version-history":[{"count":12,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/629\/revisions"}],"predecessor-version":[{"id":1032,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/629\/revisions\/1032"}],"wp:attachment":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/media?parent=629"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/categories?post=629"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/tags?post=629"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}