By Adam Nagy
When you write AddIn's for the exchange store then you'll probably want to check if the user logged into the Autodesk product actually bought your AddIn or just copied it from somewhere. In the 2016 releases you will be able to test this with the help of the functionality provided by the AdWebServices.dll.
The API is in C++ and so can be accessed from both C++ AddIn's and other ones using Platform Invoke (P/Invoke) - this is how I'm using it from the sample .NET AddIn too.
The main function you'll need is the GetUserId which will provide the currently logged in user's Internal Autodesk ID. Then using the Exchange Store API you can find out if the user with the given Internal Autodesk ID has actually bought your application.
You can find the sample project here: https://github.com/ADN-DevTech/EntitlementAPI_Inventor
Because of new security measures in Inventor 2016, when loading the sample project for the first time you'll get a dialog like this, where you'll need to Allow the AddIn to load:
If there is a user currently logged into Inventor, then you'll get this message:
If no user is logged in or something goes wrong then you'll get this message: