Recently, I've found great library for net handling (POP, SMTP, FTP, HTTP and others) - LumiSoft.Net http://www.lumisoft.ee/lsWWW/download/downloads/Net/LumiSoft.Net.zip
Here is the link to the help index for that library http://www.lumisoft.ee/lswww/download/downloads/Net/Help/. Exciting!It's open source (C# .NET) and completly free for modifing and using in commercial projects. Wonderfull, many thanks to it's author!
So, I was engaged in using this library in Dynamics NAV.
First of all, this library should be compiled as COM Automation object. For this possibility:
1) COM Interop on the project tab should be checked.
2) Special attributes for COM sharing should be appointed for the classes:
[ComVisible(true), ClassInterface(ClassInterfaceType.AutoDual),Guid(" ... ")]
Namespace System.Runtime.InteropServices should be used.
3) GUID for assembly should be appointed:
[assembly: Guid(" ... ")]
4) some classes should be redesigned (for example, static members are not visible in COM)
If Guids are not appointed that way, the linker automatically creates it, but every time you making changes in the source code you would have new Guids. It's too difficult for parallel NAV debugging, because C\AL variables are droped after new COM server is registered. The description "Unknown Automation Server.Unknown Class" is shown in that case.
I used special tool for Guid creation (Tools - Create Guid in Visual Studio).
In Dynamics NAV I've created a pair of simple tables (Message and Mailbox). Message have a table relation to Mailbox:
Then, I've set the mailbox properties:
After that a report retrieving message headers was developed. It goes through Mailboxes with Active status and scan for the new e-mails. Received e-mails can be saved to file and then import in NAV (not done yet). The main problem that COM is working with a String type, which has no limitation for it's size. But as we know type Text in Dynamics NAV is limited by 1024 characters. If we try to read a BodyText property for example, we get overflow exception.
The result is stored in Message table:
This Report could be started by Navision Application Server to check and retrieve new messages, dialog window is not shown in that case.
Next task will be developing full message viewer in Dynamics NAV. I have an idea to create some kind of service desk in Dynamics NAV. Employees could post their request by e-mail, a ticket in Dynamics NAV should be created automaticaly and a notification for the service team is send. Then, the service engineers assign themselfs to the ticket processing. The author of the ticket should get a feedback about ticket status.
1 comment:
Hi,
the problem of text limitations of 1024 characters could be solved with an automation variable 'Navision Attain Hash 1.0'.BSTRConverter.
Look for an example on http://www.mibuso.com/forum/viewtopic.php?f=23&t=13161&start=0
Post a Comment