11-17-2008 12:20 AM
Hi,
Using a C# application, we are trying to add/delete a user from TestStand Users.ini file.
The CreateDeleteUsers.seq file in the TestStand samples is being used as reference.
We have observed that we are able to add the user to the user file list using
engine.UsersFile.UserList.SetPropertyObjectByOffset(0, 0X1, newUser.AsPropertyObject());
However, when we try to add the user to the user group, the sample in CreateDeleteUsers.seq file says
RunState.Engine.GetUserGroup(Locals.GroupName).Members.SetPropertyObjectByOffset(0, 0x1, Locals.User.AsUser.LoginName)
If we try to replicate this in C#, the API looks for the final parameter (which is LoginName in the CreateDeleteUsers.seq file) as a property object
engine.GetUserGroup(this.GroupName).Members.SetPropertyObjectByOffset(0, 0X1, newUser.AsPropertyObject());
This causes an object reference exception when we run the application.
Please advise on the proper procedure to follow.
Thanks
Solved! Go to Solution.
11-17-2008 10:40 AM - edited 11-17-2008 10:44 AM
Arun -
The members property is an array of string, so the 3rd parameter to SetPropertyObjectByOffset requires a string property object, ie. the user name, and not the user object. Passing the user object will error with "-17308; Specified value does not have the expected type.". The example should really be using SetValStringByOffset to be more clear so that you specify only the actual string user name.