Overview
This article explains several possible reasons why new Hubshare user creation from M-Files could fail.
Sample Case
When trying to create Hubshare user in M-Files user will get error like below:
VaultScriptSessionTemplates.cpp, 340, Couldn't create a new user in Hubshare. (0x80131500)
VaultScriptSessionTemplates.cpp, 522, Couldn't create a new user in Hubshare. (0x80131500)
CoActiveScriptSite.cpp, 897, Couldn't create a new user in Hubshare. (0x80131500)
CoActiveScriptSite.cpp, 739, Couldn't create a new user in Hubshare. (0x80131500)
BeforeCheckInChangesFinalize::Hubshare.VAF.MFEventHandlerBeforeCheckInChangesFinalize, 22, Couldn't create a new user in Hubshare. (0x80131500)
CoDynamicCLRObjectWrapper.cpp, 552, Couldn't create a new user in Hubshare. (0x80131500)
CoDynamicCLRObjectWrapper.cpp, 322, Couldn't create a new user in Hubshare. (0x80131500)
ManagedError.cpp, 149, Couldn't create a new user in Hubshare. (0x80131500)
VaultApplicationBase.cs, 275 (IL:67), Couldn't create a new user in Hubshare. (0x80131500)
VaultApplicationBase.cs, 924 (IL:92), Couldn't create a new user in Hubshare. (0x80131500)
MethodInfo.cs, 264 (IL:336), Couldn't create a new user in Hubshare. (0x80131500)
VaultEvents.cs, 157 (IL:689), Couldn't create a new user in Hubshare. (0x80131500)
Cause and Reason
This happens when trying to create an external user with an internal domain name which is not allowed.
Solution
Several things could be causing this error.
Make sure that the account creating the new ones is an Admin for Hubshare.
With company email domain address, you can only create internal users.
Make sure that there are available licenses for the new accounts.
Make sure that the token is valid.
When changing token You should refresh and restart the vault after the change.
Here is one article for the token upgrade:
How to generate a Hubshare API Token (site.com)
Token upgrade is also mentioned in this guide (section 2.4 point 10):
Setting Up and Using M-Files Plugin for Hubshare (site.com)
