Get how many licenses a user has in CPP

Some users may have more than one license associated to him, when my application call GetUserLicenses, I need to instantiate a UserLicense* with as many licenses as the user has, but I could not find a method in LexActivator library that gives me the number of licenses the user has so I can make the UserLicense* in the correct size. Is there a way to get the number of licenses from an user?

Hi @AugustoMartins,

Thank you for reaching out.

The GetUserLicenses() function retrieves user licenses by making a network request to the server. Since the license count is not known prior to this call, you will need to allocate a buffer with a reasonable maximum size beforehand.

After a successful call, you can determine the actual number of licenses by iterating through the array and checking when the key field becomes empty. This indicates you have reached the end of valid licenses.

If the function returns LA_E_BUFFER_SIZE, your buffer was insufficient, and you should increase the size accordingly.