反正是有连接到使用TM1 API VBA中使用CAM身份验证的服务器?
Is there anyway to connect to a server that uses CAM authentication in VBA using the TM1 API?
我已经试过基础上,回答以下code在这里找到: 连接到服务器时,错误
I've tried the following code based on the answer found here: Error when connecting to server
Dim credentials(1 To 3) As Long
credentials(1) = TM1ValString(hPool, Trim(CAMNamespace), 0)
credentials(2) = TM1ValString(hPool, Trim(ClientName), 0)
credentials(3) = TM1ValString(hPool, Trim(ClientPassword), 0)
vCredentials = TM1ValArray(hPool, credentials, 3)
hServer = TM1SystemServerConnectWithCAMNamespace(hPool, vServerName, vCredentials)
然而,这导致Excel崩溃。
However, this causes Excel to crash.
我知道我连接到正确的服务器,我知道的用户名/密码是正确的,我知道TM1 API是否正确安装在我的电脑上也是如此。
I know I'm connecting to the correct server and I know the usernames / passwords are correct, I know that the TM1 API is installed correctly on my computer as well.
我拿出基于IBM客户的支持和一之间的对话这一解决方案
I've come up with this solution based on dialog between IBM customer support and I.
它要求你添加以下声明函数:
It requires you add the following declare function:
Declare PtrSafe Function TM1SystemServerConnectWithCAMNamespace Lib "tm1api.dll" (ByVal hPool As Long, ByVal vServerName As Long, ByVal vCAMArr As Long) As Long
登录code:
The login code:
Dim hArray As Long
Dim lArray(3) As Long
'Login to TM1 using CAM authentication
hArray = TM1ValArray(hPool, lArray(), 3)
TM1ValArraySet hArray, TM1ValString(hPool, "DOMANIN_NAME", 0), 1
TM1ValArraySet hArray, TM1ValString(hPool, "TM1_USER_NAME", 0), 2
TM1ValArraySet hArray, TM1ValStringEncrypt(hPool, "TM1_PASSWORD", 0), 3
hServer = TM1SystemServerConnectWithCAMNamespace( _
hPool, TM1ValString(hPool, "TM1_SERVER_NAME", 0), hArray)