This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using LogInAsUser Method

Hello !

I'm trying to allow an excel document to have admin autorisations so the document can do things the user can't.

In order to do that, I'm trying to connect to my M-Files vault with an admin account when I open the document (as i would with the current user session) :

I define a MFiles Client Application Object :

Dim oClientApp As Object
Set oClientApp = CreateObject("MFilesAPI.MFilesClientApplication")

Then I define my vault connection :

Dim oVaultConnection As Object
Set oVaultConnection = CreateObject("MFilesAPI.VaultConnection")
Set oVaultConnection = oClientApp.GetVaultConnection("Myvault")

And finally, I log in with the correct credentials :

Dim oVault As Object
Set oVault = CreateObject("MFilesAPI.Vault")
Set oVault = oVaultConnection.LogInAsUser(MFAuthTypeSpecificMFilesUser, "Username", "Password")

With Username and Password being the actual username and the actual password.

However, when I run the code, I get the following error :

"Automation error
Indicator proposed incorrect"

I've been trying every possible method and parameters for days and I'm out of options.

Does anyone have a clue on what to do ? The API isn't really helping...

Parents
  • Oh the header did sound great - login as admin and then login in "as a user" in meaning of using the same rights just to have a look what the user sees and is allowed to do.

    Otherwise you have always to force yourself not to forget the tests with limited rights because it normally all works fine if you have sysadmin rights. :)

  • Hello  Falk,

    No, I only intend to give a document its own autorisations so it's easier to code interactions with M-Files. I get errors way too often because of the lack of autorisations from the user. To solve that, I can either give users full autorisations everywhere (which I don't really like or can do) or only when using the document.

    I haven't manage to make it work yet since I've been away for a few days but I'm sure it's a matter of server parameters.

Reply
  • Hello  Falk,

    No, I only intend to give a document its own autorisations so it's easier to code interactions with M-Files. I get errors way too often because of the lack of autorisations from the user. To solve that, I can either give users full autorisations everywhere (which I don't really like or can do) or only when using the document.

    I haven't manage to make it work yet since I've been away for a few days but I'm sure it's a matter of server parameters.

Children
No Data