I was watching Vjeko’s lecture in NAVTechDays 2013. He gave me an idea on the add-in installation. Thank you Vjeko.
It is now finished and time to share this with you all. The basic function Codeunit is used to handle the downloading and installing of the add-in. In the Add-on Setup Page I put an action to trigger the Add-ins validation.
This function will call the CheckAddins trigger on the Setup Table. There I have a simple code
[code]
IF NOT CANLOADTYPE(HardwareHubProxy) THEN
AddinMgt.DownloadAnInstallServerAddIn(
‘HardwareHubProxy.dll’,
‘https://dl.dropboxusercontent.com/u/33900811/NAV/Add-Ins/Server/Advania/HardwareHubProxy.dll’,
Text002);[/code]
That will check if the add-in is installed and if not call a trigger in the add-ins function Codeunit to install the add-in. This works both for the client and server.
In this example I am installing the HardwareHubProxy.dll that is required on the server to use the Hardware Hub. Text002 is ‘ENU=Connection to the Advania Hardware Hub;ISL=Tenging við vélbúnaðargátt Advania’.
When installing the add-in I begin by downloading it into a Base64 string. This is always done on the server. The add-in is then saved to a temporary file, on the server for a server add-in and on the client for a client add-in.
Next I create a command file that is used to copy the temporary file to the add-ins folder. This command file is then executed. Before execution there is a check to see if the current user is able to write to the add-in directly. If so, then the add-in is copied to the add-ins folder and the process finishes.
If the service user is not able to write to the server add-ins folder the user will get a save-as dialog and is asked to copy the file to the server add-ins folder. In all my tests the server has been able to save the add-in without problems.
By default the running client will not be able to write the add-in to the client add-ins folder. If this is the case then a confirmation dialog will be prompted as the copy function is running in an elevated access mode.
Hi Gunnar,
I think that tool is great and a step into the right direction! But I see the never ending story of the user permissions as a problem here as well. In the most cases the user cant write to his own add-in directory and he gets an error/information (since Windows 7). Is that a problem here too? or must the user be the admin (with low security setup)?
kind regards,
Matthias König
Hi Matthias
If the user is a local admin then he will be prompted with a security confirmation and will be able to install the addin. If not then I would try to create a subfolder in the add-ins directory with special permissions and change the code to install into that directory. You should be able to automatically create that subfolder with powershell or a group policy script.
Hello,
that sounds good. I will try it 🙂 thanks.
Hi,
thanks for the nice post. I try to implement a similar function, but have some problems.
For me it seems, that CANLOADYTPE is just checking the add-ins folder on the NAV Server.
My test results:
Assembly is stored on:
SERVER | CLIENT
NO | NO -> CANLOADTYPE == FALSE
NO | YES -> CANLOADTYPE == FALSE
YES | NO -> CANLOADTYPE == TRUE
YES | YES -> CANLOADTYPE == TRUE
I also changed the “RunOnClient”-property of the DotNet-variable, but i seems to have no influence.
I need method like this, as i want to check if a client-addin should be visible or not. Do you have any idea?
Version 7.00.34194.
kind regards,
David
Hi David
I have not tested on 2013 but it seems that the RunOnClient along with CANLOADTYPE is working on my R2 version. For example I am adding a dotnet timer on the client side and that DLL is not available on the server.
Hi
Actually when I compile I am getting “TableData 10000200 does not exist” in CU 50207. Could you please tell me what is the table and what are the required fields ?
Hi Gunnar, I am also having same error ” TableData 10000200 does not exist” in CU 50207″. Please guide me.
You need to remove the reference to that table. You need to understand what the code is doing to be able to build a version for your own.
Thanks Gunner, i have removed the reference.