12-16-2008 12:21 AM
Hi,
I have created a new group using the API calls in C#. I need to ensure that the newly created group is not deleted. So I tried using the SetFlag method to set these property flags.
The code snippet is as
userGroup = eng.NewUser(null);
userGroup.LoginName = "Test";
userGroup.AsPropertyObject().SetFlags("PropFlags_NotDeletable", 0x1, 0x400000);
userGroup.AsPropertyObject().SetFlags("PropFlags_NameNotEditable", 0x1, 0x400000);
However, the newly created group does not have these flags set.
How do I go about setting these flags?
Thanks
Arun
Solved! Go to Solution.
12-18-2008 01:32 AM
12-18-2008 04:41 AM
Hi Juergen,
Thanks for your response. I guess I have not reported my problem clearly.
I am fairly new to TestStand so I may be wrong about this; the User Group in TestStand is also of User datatype.
I have created a new group by using the eng.NewUser(null) call.
This newly created group should not be editable or deletable. With this in mind, I used the SetFlags() API call. I now have a new group with name Test, however the appropriate propFlags are not set for the group.
How do I go about setting these flags using API's?
Please advise.
Thanks
Arun
12-18-2008 05:24 AM
12-18-2008 05:28 AM
Hi Juergen,
I am building a C# wrapper around the User Management module of TestStand. So have to work only with API's.
Thanks
Arun
12-18-2008 06:16 AM
12-18-2008 07:04 AM
12-18-2008 08:45 AM
You are passing incorrect arguments to the SetFlags function. The first parameter is the lookup string of the property you want to set the flags on. In this case, pass an empty string to refer to the User object itself. The second parameter specifies function options. In this case you need none. The third parameter specifies the flags you want set on the property. You need to pass the combination of flags (PropFlags_NotDeletable | PropFlags_NameNotEditable). If you call SetFlags function again, it will overwrite the flags you set in previous calls.
userGroup.AsPropertyObject().SetFlags("", 0x0, PropFlags_NotDeletable | PropFlags_NameNotEditable);
12-18-2008 11:32 PM
Hi Juergen,
Thanks for all your assistance. However, my mistake lay where Erik pointed out. I was passing the wrong parameters in the SetFlags() method. I have accordingly changed the parameters and the problem is fixed.
Regards
Arun
12-18-2008 11:35 PM
Hi Erik,
Thank you for pointing out the error in my code. I have rectified it as per your suggestion and now the behaviour is as expected.
Thanks
Arun