Hi @annanykolenko71,
The way I’ve been doing that sort of thing is with the below code
public List<string> GetRoleNames()
{
SMAccessUsers users = new SMAccessUsers();
users.OpenScreen();
users.Form.Username.Select("admin");
List<string> roleNamesToReturn = new List<string>();
int pageCount = users.UserRoles.PageCount();
for (int y = 0; y < pageCount; y++)
{
int count = users.UserRoles.RowsCount();
for (int i = 1; i < count + 1; i++)
{
users.UserRoles.SelectRow(i);
if (users.UserRoles.Row.Selected.GetValue())
roleNamesToReturn.Add(users.UserRoles.Row.Rolename.GetValue());
}
}
return roleNamesToReturn;
}
Whenever I try to use the Rows property(as in users.UserRoles.Rows) it always returns an empty list, so that is why I have to iterate through everything element by element.
Let me know if you run into any more issues!
Philip Engesser
Hi @annanykolenko71 ,
Please refer below code to get RolesList-
List<string> lstroleNames = new List<string>();
for (int i=0;i<= users.RolesList.RowsCount(); i++)
{
if(users.RolesList.Row.Selected.GetValue().VerifyEquals(true))
{
lstroleNames.Add(users.RolesList.Row.Rolename.GetValue());
}
}
hope this helps!!
Thank you so much! It worked.