Hello Kristy,
I can’tlook at this until Monday, but if you can wait until then, could you post thebit of your code that creates the user here and I’ll take a look?
Howard ___ Howard Pell Senior Technical Educator Liaison, Special Projects Open Text Corporation www.opentext.com (519) 888-7111 Ext. 2203
From:eLink Discussion: Development Discussion[mailto:development@elinkkc.opentext.com] Sent: Friday, January 25, 20084:54 PMTo: eLink RecipientSubject: LAPI utility to importusers
LAPI utility to import users
Posted by kristyshen (Shen, Kristy) on 01/25/2008 04:47 PM
Hi, We currently have utility developed in .NET that uses LAPI to import a list of users into Livelink. (this automates the task of adding users one by one via the Livelink interface). However, I get this error message when I try to add a user with LAPI: "ERROR: Could not create a new My Workspace. The item is not created.". I'm able to add the same user successfully via the interface directly. (I'm signed on with the same credentials with both methods) Please help.
Kristy,
I don’tsee anything obvious. I wonder if your GUI is correct. That is, have youchecked that your drop-down lists have the correct spelling and case-sensitivityas what is in Livelink? Especially the group names.
Can you runthis code with the Builder running and set a breakpoint in Builder and inspectthe variables you are passing in? Does it look like what you expect?
From:eLink Discussion: Development Discussion[mailto:development@elinkkc.opentext.com] Sent: Monday, January 28, 20089:57 AMTo: eLink RecipientSubject: RE LAPI utility to importusers
RE LAPI utility to import users
Posted by kristyshen (Shen, Kristy) on 01/28/2008 09:48 AM
In reply to: RE LAPI utility to import users
Posted by hlpell (Pell, Howard) on 01/25/2008 05:31 PM
Hi Howard! Good to hear from you . The method used to add users is copied below (I've also attached the full version of the code as a text file). Thanks for you help! private void Add_Users() @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ DataGrid2.DataSource = null; @ @ @ @ @ @ DataGrid2.DataBind(); @ @ @ @ @ @ ArrayList list = new ArrayList(); @ @ @ @ @ @ ///////////////////////////////////////////////////////// @ @ @ @ @ @ //Create LAPI user object to add new users @ @ @ @ @ @ try @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ LLValue objLLValue = new LLValue(); @ @ @ @ @ @ @ @ objLLValue.setAssoc(); @ @ @ @ @ @ @ @ session = new LLSession (LL_SERVER, LL_PORT, "", pUserId, PasswordBox.Text, objLLValue); @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ //Check formate of windows user id (for testing) @ @ @ @ @ @ @ @ if (pUserId == "" || pUserId == null) @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ pUserId = NULL_USER; @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ LAPI_USERS users = new LAPI_USERS( session ); @ @ @ @ @ @ @ @ //For each row in the excel file, create a user @ @ @ @ @ @ @ @ foreach(DataGridItem dataGridItem in DataGrid1.Items) @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ if (dataGridItem.Cells[3].Text == " ") @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ continue; @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ int status; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ //Get Permissions Code @ @ @ @ @ @ @ @ @ @ int permCode = 0; @ @ @ @ @ @ @ @ @ @ for (int i=PERM_INDEX; i < PERM_INDEX + 6; i++) @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ if (dataGridItem.Cells[i].Text == "yes" || dataGridItem.Cells[i].Text == "y") @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ switch (i) @ @ @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ case PERM_INDEX: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ permCode = permCode | privLogin; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ break; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ case PERM_INDEX + 1: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ permCode = permCode | privPubAccess; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ break; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ case PERM_INDEX + 2: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ permCode = permCode | privUsers; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ break; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ case PERM_INDEX + 3: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ permCode = permCode | privGroups; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ break; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ case PERM_INDEX + 4: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ permCode = permCode | privUserAdmin; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ break; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ case PERM_INDEX + 5: @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ permCode = permCode | privSysAdmin; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ break; @ @ @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ LLValue userData = ( new LLValue() ).setAssocNotSet(); @ @ @ @ @ @ @ @ @ @ LLValue id = ( new LLValue() ); @ @ @ @ @ @ @ @ @ @ LLValue row = ( new LLValue() ).setAssocNotSet(); @ @ @ @ @ @ @ @ @ @ LLValue uatt = (new LLValue()); @ @ @ @ @ @ @ @ @ @ row.add( "LastName", dataGridItem.Cells[2].Text ); @ @ @ @ @ @ @ @ @ @ row.add( "FirstName", dataGridItem.Cells[1].Text ); @ @ @ @ @ @ @ @ @ @ //row.add( "MailAddress", dataGridItem.Cells[0].Text ); @ @ @ @ @ @ @ @ @ @ row.add( "MailAddress", ((DropDownList)dataGridItem.FindControl("Dropdownlist3")).SelectedValue.ToString() ); @ @ @ @ @ @ @ @ @ @ // Set user as authenticated user @ @ @ @ @ @ @ @ @ @ userData.add("ldap", "external non syncd user"); @ @ @ @ @ @ @ @ @ @ userData.add("ok", LLValue.LL_TRUE); @ @ @ @ @ @ @ @ @ @ //Create the user @ @ @ @ @ @ @ @ @ @ status = users.CreateUser( dataGridItem.Cells[3].Text, "", permCode, userData, LAPI_USERS.GROUP, DropDownList1.SelectedValue, row, id ); @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ //Label1.Text = excelcount.ToString(); @ @ @ @ @ @ @ @ @ @ if ( status != 0 ) @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ String statustext = session.getStatusMessage(); @ @ @ @ @ @ @ @ @ @ @ @ String errtext = session.getErrMsg(); @ @ @ @ @ @ @ @ @ @ @ @ String apitext = session.getApiError(); @ @ @ @ @ @ @ @ @ @ @ @ textMessage = "ERROR: " + errtext + "\n" + apitext; @ @ @ @ @ @ @ @ @ @ @ @ //textMessage = DataGrid1.Columns.Count.ToString(); @ @ @ @ @ @ @ @ @ @ @ @ //textMessage = excelcount; @ @ @ @ @ @ @ @ @ @ @ @ if (statustext.IndexOf("impersonate",0,statustext.Length) >= 0) @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ textMessage = "ERROR: You have insufficient permissions or your Windows ID cannot be authenticated in Livelink."; @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ else @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ textMessage = "SUCCESS: New user has been added!"; @ @ @ @ @ @ @ @ @ @ @ @ //Add user to groups here: @ @ @ @ @ @ @ @ @ @ @ @ int statustemptot = 0; @ @ @ @ @ @ @ @ @ @ @ @ string err_roles = ""; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ string tempstr1 = PERM_INDEX.ToString() + " - " + excelcount.ToString(); @ @ @ @ @ @ @ @ @ @ @ @ int tempcount1 = 10; @ @ @ @ @ @ @ @ @ @ @ @ for(int i = PERM_INDEX + 6; i < excelcount; i++) @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ tempcount1++; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ if (dataGridItem.Cells[i].Text == " ") @ @ @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ continue; @ @ @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ @ @ @ @ int statustemp = users.AddUserToGroup(dataGridItem.Cells[3].Text,LAPI_USERS.GROUP,dataGridItem.Cells[i].Text); @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ if (statustemp != 0) @ @ @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ statustemptot = statustemp; @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ err_roles = err_roles + dataGridItem.Cells[i].Text + ", "; @ @ @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ //Label1.Text = tempcount1.ToString() + " - " + tempstr1; @ @ @ @ @ @ @ @ @ @ @ @ if (statustemptot !=0 ) @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ err_roles = err_roles.Substring(0,err_roles.Length - 2) + "."; @ @ @ @ @ @ @ @ @ @ @ @ @ @ textMessage = "SUCCESS: User added, but could not assign following roles: " + err_roles; @ @ @ @ @ @ @ @ @ @ @ @ @ @ //textMessage = statustemptot.ToString(); @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ @ @ else @ @ @ @ @ @ @ @ @ @ @ @ { @ @ @ @ @ @ @ @ @ @ @ @ @ @ textMessage = "SUCCESS: New user has been added to system and to all roles"; @ @ @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ } @ @ @ @ @ @ @ @ @ @ //Add user to arraylist @ @ @ @ @ @ @ @ @ @ list.Add(new NewUser(dataGridItem.Cells[1].Text, dataGridItem.Cells[2].Text, dataGridItem.Cells[3].Text, DropDownList1.SelectedValue, ((DropDownList)dataGridItem.FindControl("Dropdownlist3")).SelectedValue.ToString(), textMessage)) ; @ @ @ @ @ @ @ @ } @ @ @ @ @ @ } @ @ @ @ @ @ catch ( Exception e2 ) @ @ @ @ @ @ { @ @ @ @ @ @ @ @ textMessage = "Application encountered an exception:\n"+ e2.Message + "\n" + e2.StackTrace; @ @ @ @ @ @ @ @ Label1.Text = "Application encountered an exception:\n"+ e2.Message + "\n" + e2.StackTrace; @ @ @ @ @ @ } @ @ @ @ @ @ ///////////////////////////////////////////////////////// @ @ @ @ @ @ @ @ //resultsMessage = "Results of Bulk User Add:"; @ @ @ @ @ @ @ @ //Bind user add results to DataGrid2 @ @ @ @ @ @ DataGrid2.DataSource = list; @ @ @ @ @ @ DataGrid2.DataBind(); @ @ @ @ @ @ Highlight_Rows(DataGrid2); @ @ @ @ }
I’mteaching all week so may not get to this today. Still, I’d really like tosee you set a breakpoint in the builder and see exactly what your s/w issending to Livelink. Take a look at the LAPI course manual on page 2-15 forfull instructions on how to do this.
From:eLink Discussion: Development Discussion[mailto:development@elinkkc.opentext.com] Sent: Monday, January 28, 20085:46 PMTo: eLink RecipientSubject: Debugger outputs fromboth environments
Debugger outputs from both environments
Posted by kristyshen (Shen, Kristy) on 01/28/2008 05:42 PM
In reply to: Howard,
Posted by kristyshen (Shen, Kristy) on 01/28/2008 11:47 AM
Hi Howard: I tried your suggestion and ran the builder on the env where the app was failing on. I don't see the error message anywhere in the builder's debugger output. Please find attached the output from the debugger in both environments. For the env, where the user was added successfully, I could see that the debugger's log entries indicates the user's credentials. I also found something else interesting...I think the login I used to sign in to the LAPI app is cached somewhere for the unsuccessful environment. Even when I took away my login rights, I was still able to login, whereas for the other environment, the LAPI app indicated that I don't have access.
I think we are getting somewhere. You mentioned two environments, are you saying you have two servers, two builders, two Livelinks? So how exactly are they different? This could be important.----- Original Message -----From: eLink Discussion: Development Discussion <development@elinkkc.opentext.com>To: eLink Recipient <devnull@elinkkc.opentext.com>Sent: Tue Jan 29 17:28:50 2008Subject: RE Debugger outputs from both environmentsRE Debugger outputs from both environments <https://knowledge.opentext.com/knowledge/llisapi.dll/open/14173346> Posted by kristyshen <mailto:Kristy.Shen@cibc.com> (Shen, Kristy) on 01/29/2008 05:27 PM In reply to: RE Debugger outputs from both environments <https://knowledge.opentext.com/knowledge/llisapi.dll/open/14141052> Posted by hlpell <mailto:hlpell@opentext.com> (Pell, Howard) on 01/29/2008 07:49 AM Hi Howard:Thanks for the suggestion. I did set the breakpoint like you said in both environments. In the successful environment, the breakpoint is reached as expected, and inargs has the credentials of the user I'm trying to add. However, in the unsuccessful environment, the breakpoint is not reached at all. I'm thinking it is a configuration issue. What I don't understand is that it lets me login to the LAPI app and import the script.I checked the link and it is going to the correct environment. I considered the fact that maybe it's because the code base is different, but I basically grabbed the dll and aspx files from the successful env and copied it into the unsuccessful env, then I restarted IIS and builder, but still the breakpt is not reached. I also checked that the .NET framework and LAPI and installed in both environments. (Still if either of these were missing, it wouldn't have let me even login) ________________________________[To reply to this thread, use your normal E-mail reply function.] Topic: LAPI utility to import users <https://knowledge.opentext.com/knowledge/llisapi.dll/open/14155501> Discussion: Development Discussion <https://knowledge.opentext.com/knowledge/llisapi.dll/open/786303> Livelink Server: Knowledge Center <https://knowledge.opentext.com/knowledge/llisapi.dll> To Unsubscribe from this Discussion, send an e-mail to unsubscribe.development@elinkkc.opentext.com <mailto:unsubscribe.development@elinkkc.opentext.com?subject=Unsubscribe> .