I'm currently struggling with a problem trying to extract whether or not a user is taking up a named user license. I am trying to work with the NamedUserStatus enumeration but no matter what I change in the Admin Console my program returns 'NONE' as the enumeration member.
Question
Question
Replies
Does this code work if you know the SecurityIdentifier for the user?
SecurityIdentifier sid = new SecurityIdentifier(userSidString); UserInfo userInfo = (UserInfo)Account.GetInfo(sid, session); NamedUserStatus nuStatus = userInfo.NamedUserStatus;
If not, can you post a code snippet showing how you are retrieving the NamedUserStatus property?
Robert,
I'm working with Stan and what we're doing is:
foreach (AccountInfo info in Account.EnumAll(currentSession) )
{
name = info.Name;
TrusteeInfo information = info.GetTrusteeInfo();
.....
writer.WriteLine(" " + name + " " + information.NamedUserStatus);
}
And what gets written is:
Username1 None
UserName2 None
...
Is this not equivolent? BTW, for example, UserName1 is defined as Full in the Admin Console.
Jim
Robert,
I was able to add your code but I'm getting a cast exception between the System and Laserfiche namespaces.
How do you get your userSidString?
I'm looping through each repository, getting a connection then looping through each account and looking for NamedUserStatus on those accounts.
foreach (AccountInfo info in Account.EnumAll(currentSession)
string mySid = info.Sid.ToString();
SecurityIdentifier sid = new SecurityIdentifier(mySid);
UserInfo userInfo = (UserInfo)Account.GetInfo(sid, currentSession);
NamedUserStatus nuStatus = userInfo.NamedUserStatus;
Thanks for your help so far!
Jim
Pass info.Sid directly to Account.GetInfo:
foreach (AccountInfo info in Account.EnumAll(session)) { AccountInfo actInfo = Account.GetInfo(info.Sid, session); if (actInfo.TrusteeType == TrusteeType.LaserficheUser) { UserInfo userInfo = (UserInfo)actInfo; NamedUserStatus nuStatus = userInfo.NamedUserStatus; } }