All about the Dexterity OLE Container

Much has been asked about the Microsoft Dexterity OLE Container lately and I wanted to address this topic by providing some background on the technology and how it is used from GP. In addition, I will address how to automate OLE externally from other applications.

Definition

In principle, OLE is a compound document technology from Microsoft based on the Component Object Model (COM). OLE allows an object such as a graphic, video clip, spreadsheet, etc. to be embedded into a document, called the Container Application. If the object is playable such as a video, when it is double clicked by the user, a media player is launched. If the object is allowed to be edited, the application associated with it (the Server Application) is launched.

An object can be linked instead of embedded, in which case the Container Application does not physically hold the object, but provides a pointer to it. If a change is made to a linked object, all the documents that contain that same link are automatically updated the next time you open them. An application can be both client and server, called an Object Packager, which is not something I will cover in this article.

History of OLE

OLE 1.0, released in 1990 and was capable of maintaining active links between two documents or even embedding one type of document within another. The server and client libraries, OLESVR.DLL and OLECLI.DLL, were originally designed to communicate between themselves using the WM_DDE_EXECUTE message. OLE 2.0 followed in the steps of OLE 1.0, sharing many of the same design goals, but was re-implemented on the COM platform. New features were automation, drag-and-drop, in-place activation and structured storage.

OLE custom controls were introduced in 1994 as a replacement for the Visual Basic Extension controls. In particular, any container that supported OLE 2.0 could already embed OLE custom controls, although these controls cannot react to events unless the container supports this. OLE custom controls are usually shipped in the form of a dynamic link library with the .ocx extension. In 1996 all interfaces for controls (except IUnknown) were made optional to keep the file size of controls down, so they would download faster.

The Dexterity OLE Container

The Dexterity OLE Container is part of the Dexterity Shared Components. In OLE compound document technology, it is the OLE client application (CONTAIN.EXE), which holds the linked or embedded objects. The Dexterity OLE Container first surfaced with the release of Dexterity 3.0 in 1993.

The Dexterity OLE Container can be opened via most record notes windows in the Dynamics GP application, by clicking on the paperclip button.

















Dexterity OLE Container linked or embedded objects are stored in the path indicated by the OLEPath key in the DEX.INI file.














The following is a typical DEX.INI file layout:


[General]
.
.
OLEPath=C:\Notes\
.
.


When an object is linked or embed in the Dexterity OLE Container window for the first time, Dynamics GP will append the 'Intercompany ID'\OLENotes to the OLEPath directory to create a unique physical storage directory for each object attached or embedded to a record note. In turn, the note index value associated to the record note serves as a file reference to the OLE object, this is an 8-character hexadecimal file name is created with the hexadecimal value of the note index.

For example, if the note index associated to the record is 16, a file name is created with the name 00000010.

The note index is also stored in the Records Notes Master table (SY03900) and a text is appended to the note in GP with the legend "OLE Link present".


SELECT NOTEINDX, DATE1, TIME1, DEX_ROW_ID, TXTFIELD FROM SY03900

The query will produce the following resultset:


NOTEINDX DATE1 TIME1 DEX_ROW_ID TXTFIELD
--------------------------------------- ----------------------- ----------------------- ----------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
16.00000 2008-11-28 00:00:00.000 1900-01-01 15:31:26.000 1 OLE Link present.

(1 row(s) affected)

The following is the physical file representation.









*Click on image to enlarge

NOTE: The next note index value is obtained from NOTEINDX column, in the company master table, DYNAMICS.dbo.SY01500.

Unfortunately, the Dexterity OLE Container application was designed only to work from within Microsoft Dynamics GP, hence no programmatic interface was created to support external integrations from other applications. There are no command lines to the CONTAINER.EXE application, however there are a few DDE commands available: Open, Close, Delete, Save. These correspond to the Dexterity OLE function library to control the OLE Container.

The Dexterity OLE Container does not make use of the Microsoft OLE Container Control, and was implemented as a C/C++ based application. Other sources have alluded to the fact that it was implemented based on an MSDN container sample.

Related Articles

KB article 268470 - "Sample: FramerEx.exe Is an MDI ActiveX Document Container Sample Written in Visual C++", Microsoft Support.

Visual C++ Samples - OCLIENT Sample: Illustrates a Visual Editing Container Application. Microsoft Developer's Network (MSDN).

Visual C++ Samples: DRAWCLI Sample: Illustrates Integrating Active Container Support with Application-Specific Features. Microsoft Developer's Network (MSDN).

While the Dexterity OLE Container is not of much help as an external application, you can always run the CONTAIN.EXE application, then drag-and-drop any of the hexadecimal file references to the application's desktop. In turn this will open the linked or embedded objects.

In my next installment, I will show you how to automate the OLE Container from other applications in order to read standard Dynamics GP OLE notes.

Until next post!

MG.-
Mariano Gomez, MIS, MVP, MCP, PMP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com/

Comments

Unknown said…
Looking forward to the rest of the series. We have so many customers who store all *kinds* of attachments in those note fields. So far so good until upgrade time...then the note indexes have been a bit hairy.
Mariano Gomez said…
From MSDynamicsWorld.com

http://msdynamicsworld.com/story/customer-relationship-mgmt/blogs-codename-crm-5-roletailored-user-interface-nav-2009-gp-and-de

MG.-
Mariano Gomez
http://www.maximumglobalbusiness.com
Anonymous said…
Is there any way to update the notes from backend (database level) and add the linked object/path? I have lots of images that I need to link with the vouchers. If I do so from the database, it will save my users time.
Mariano Gomez said…
Bab,

The linked object path is stored within the physical file associated to the note index. There is no way to update this path via SQL Server.

Best regards,

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
Anonymous said…
Mariano I am not sure if you receive this comment or not. so I am posting it again.

This is what happened:
1.I attached an image file to an invoice and then save the invoice.
2. After saving the invoice I delete the image file that I select on step 1 but when I clicked on the object it displays the image.

Now here is my question:

1. After I deleted the attached image file, how it is displaying the image? It should say file does not exist or something.

2. Since it displays the image even after we deleted the image file, linked path must be stored somewhere, right? In this case it should have a new path because it’s not looking at the image file that I initially attached. ( As it does not exist anymore)

Let me know thanks.
Mariano Gomez said…
Bab,

OLE means Object Linking and Embedding, so if your image was not linked, then it must have been embedded, in which case, you will still be able to see the image even if you delete the physical file, because the image now resides in the container.

MG.-
Anonymous said…
Mariano,

The file created at 'Intercompany ID'\OLENotes are in hexadecimal format? What format of files were created when we attached a document?

Do you know if it is possible to create a file in this format with linked or embedded document? If so, can you provide me some info?

Thanks
Mariano Gomez said…
Bab,

I have no specifics on the storage format. As of today, I continue to research everything I can on OLE containers, but cannot provide any further details. Whatever my findings are I will let you know.

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
Anonymous said…
Has the next installment been issued yet?

I'd really like to know how to automate the OLE Container from other applications in order to read standard Dynamics GP OLE notes.
Mariano Gomez said…
Anonymous,

Still working on automating the OLE container, it has been a hard piece of information to obtain from MS for some reason. Standard automation code does not work on these files due to serialization issues. So it may well be a good time before you see a follow up.

Thanks for your interest.

MG.-
Mariano Gomez, MVP
Maximum Global Business, LLC
http://www.maximumglobalbusiness.com
Unknown said…
Mario,

My team has found a new bug with Microsoft Dynamics 9, Ole Container and Terminal Server 2008.

After many months working with Microsoft to define this bug, Microsoft has elected to NOT fix the bug, even though they have acknowledged the existence of this bug.

The bug will not allow users to add/open embedded links in Ole objects created from a 2008 Terminal Server unless the links are opened within an actual 2008 Terminal Server environment. The reason… there are spaces in the folder names and files!!!!

I.e. F:\Art Department (can not open)
vs.
F:\ArtDepartment (can open).

Microsoft said we should just rename all of our files and folders and remove spaces! Of course they have blinders on and do not understand that our entire folder naming scheme is embedded through-out our Sql Server Databases, our Online Ordering System, our websites and through Dynamics…

I told the Escalation Engineer that we shouldn’t have to do this and we do not have the ability to change this on our own. At the very least, Microsoft should pay for a consultant to do this for us.

He agreed, but would not promise anything.

I also pointed out how ridiculous it sounds that we have to revert to using place-holders in lieu of spaces in a folder or file name. This is pre 1990 naming standards.


Do you know of any way to escalate this further?

Any words of wisdom would be greatly appreciated.
Mariano Gomez said…
You might be able to work around this issue by sharing your OLE notes folder with no spaces using UNC convention.

If you do this, nothing else should be impacted.

MG.-
Mariano Gomez, MVP
Anonymous said…
Do you know if there is a size limit to the container or if there is a limit to the number of documents that can be linked or embedded?
Mariano Gomez said…
Anonymous,

Not that I know of.

MG.-
Mariano Gomez, MVP
Barbara Salazar said…
Do you know how to add the customer notes from the Customer Maintenance window to Smartlist in Great Plain V.10?

I was advised on Microsoft forum that "the closest you can get is the Note Index value for assigned to the customer. the problem is that the viewable container isn't exposed within the dictionary. It is an OLE container stored outside of the company database.Perhaps with some VBA...it could be done."

Do you know how to do this using VBA to access OLE container? Thanks a lot!
Mariano Gomez said…
Barbara,
Unfortunately, not.

MG.-
Mariano Gomez, MVP
Brian said…
Mariano,
I'm trying to record a macro that will "Insert an object" "created from a file" (Word document) so my employees do not have to go searching for the file everytime they want to use this template. For some reason, and maybe its a limitation of the Container.exe program, it will not record the steps required to locate and open the file. Any suggestions?
Mariano Gomez said…
Brian,

The macro system will not interact with the container because it's a separate application, hence you will not be able to capture the steps required to open the file and attach it.

MG.-
Mariano Gomez, MVP
Anonymous said…
Is there a sql or access query that can be run/created to determine if a purchasing transaction has an attachment included? Instead of going through each vendor manually to see if there's an attachment.
Aaron said…
Hi Mariano,

We are having issues with OLE Notes in GP 2010. It worked just fine for about a year, and now we get:

"This action cannot be completed because the other program is busy. Choose 'Switch To' to activate the busy program and correct the problem"

GP is running fine, but when trying to access the linked files that are saved on the server, it throws this error several times before finally making the connection.

Another post has the following possible solution (seen below), however, I'm not sure where to make these changes. Please let me know if you have any insight. Thanks much!

Possible Solution: Your notes client is not disconnecting open sessions correctly. Change the
OLE time out settings on your server , or change the number of connections
allowed to the ole server, as well as buffered memory for OLE.
Mariano Gomez said…
Aaron,

Chances are you have a second instance of GP running. Please close GP, then go to Task Manager and check for another instance of Dynamics.exe.
Anonymous said…
We have found that in most places the paperclip is grayed out, but in some places, like the employee, it is NOT grayed out. But in either situation it is not working. The selections across the top of the window are mot there and therefore we cannot Edit Add New.

I check the Dex.ini file and there is a map for the path of OlePathHR = \\MedEvolveGP\GPdata\Notesjr_ole\

Is there anything else I should be looking for to make this OLE paper clip container work?
Anonymous said…
Hi...I'm using crystal reports with gp hr with payroll (odbc connection). I'm trying to link the notes/comments with the deduction I set up of some employees. I have all the relevant deductions but can't seem to retrieve the notes associated with the deduction. Please help.
Thanks.

Popular posts from this blog

Power Apps - Application Monitoring with Azure Application Insights

DBMS: 12 Microsoft Dynamics GP: 0 error when updating to Microsoft Dynamics GP 2013 R2

eConnect Integration Service for Microsoft Dynamics GP 2010