I followed the concept in this link:
http://www.k2underground.com/blogs/chrisg/archive/2008/04/29/getting-at-roles-via-the-api.aspx
to try to get all the roles using GetRoleNameList(). However I get an error "Login failed for user 'NT Authorityanonymous logon'. I am debugging this from my dev PC. What i dont understand is that i use the same connection and can get the role, add/remove from the role without any issues. The first part works fine. The section is green is where it fails. See my code below:
UserRoleManager urmServer = new UserRoleManager();
Role _role;
urmServer.CreateConnection();
SCConnectionStringBuilder builder = new SCConnectionStringBuilder()
{Host = "myservername",
Port = 5555,
Integrated = true,
IsPrimaryLogin = true,
Authenticate = true,
};
urmServer.Connection.Open(builder.ConnectionString);
_role = urmServer.GetRole("myrolename");
string test = string.Empty;
foreach (RoleItem roleitem in _role.Include)
{
test = roleitem.Name;
}
_role.Include.Add(new UserItem("K2:username"));
urmServer.UpdateRole(_role);
this part fails with NT AUthorityAnonymous logon failure:
string[] myroles = urmServer.GetRoleNameList();
urmServer.Connection.Close();
My goal is to get a list of all the roles. Perhaps there is another way?
thanks