Cannot connect to server configured for CAM (Active directory hook) using the Cognos TM1 API

半城伤御伤魂 提交于 2020-01-04 14:13:32

问题


Is there anyway to connect to a server that uses CAM authentication in VBA using the TM1 API?

I've tried the following code based on the answer found here:
SystemServerCAMSecurityRequired error when authenticating using Cognos

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)

However, this causes Excel to crash.

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.


回答1:


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

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)       


来源:https://stackoverflow.com/questions/32897048/cannot-connect-to-server-configured-for-cam-active-directory-hook-using-the-co

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!