I'm having trouble getting the aaApi_Login3 api to work.
I'm pretty sure its with the callback to get the IMS user id because I'm not really familiar with that.
here is my api calls and delegate for the callback (note my API wrappers and delegate are in a c# dll which I referenced.
[DllImport("c:\\Program Files\\Bentley\\ProjectWise\\bin\\dmscli.dll")] public static extern bool aaApi_Login3(int lDsType, string lpctstrDSource, string lpctstrUser, string lpctstrPassword, string lpctstrSchema, ref Guid lpcImsUserId); [DllImport("c:\\Program Files\\Bentley\\ProjectWise\\bin\\dmscli.dll")] public static extern void aaApi_RegisterImsUserIdCallback(AAPROC_IMSUSERIDCALLBACK fnCallback); public delegate Guid AAPROC_IMSUSERIDCALLBACK();
then I did this for calling it
//..previous code cut off //register IMSUserIDcallback PWWrappers.AAPROC_IMSUSERIDCALLBACK IMScallback = new PWWrappers.AAPROC_IMSUSERIDCALLBACK(mycallback); PWWrappers.aaApi_RegisterImsUserIdCallback(IMScallback); //try to log in bool isloggedin = PWWrappers.aaApi_Login3(0, "[DatasourceNameHere]", null, null, null, ref userIMS); //..code cut off
and I made a mycallback method to use in code above..but I'm I don't think I'm doing this right
public static Guid mycallback() { return new Guid(); }
when I run the code the the aaApi_Login3 returns false.
I'm at a loss for how to get this working
forget to show my userIMS declare statement....
Guid userIMS = new Guid();
aaApi_RegisterImsUserIdCallback is calling an unmanaged C++ function. You are passing a pointer to a managed C# function. i do not know of a way to get this to work. Some functions that are complex I have not been able to get to work in C# due to the nature of the arguments.
so looking at the error ID of 58087 with error message Cannot log into datasource and error details of Invalid datasource name.
I know I have the correct datasource name because if I use aaApi_Login with that datasource name it logs me on successfully. it might not even be my call back. the datasource is hosted by Bentley. I'm just wondering if there is a problem with the API call itself.
Sorry John, I can not find aaApi_Login3 in my SDK help or the include files. what include file or function definition file is it in? In other words, where did you get the basis for the declaration? I may not have the same sdk as you.
it was in the PWPublicSDK. the PWPublicSDK.chm file. here is a screen shot of the help doc.
is this what your asking for?