I thought I would show a way you can check to see if a user is in a specific Team or Department. While there are other ways of accomplishing this also, this is a pretty easy way to check. This may not be the most efficient way of doing it, especially if your teams and departments contain lots of users.
Both of these snippets are similar, just checking the Owner.Type differently for each.
Department:
Sage.Entity.Interfaces.IOwner ownr = Sage.SalesLogix.Security.Owner.GetByOwnerDescription("Accounting");
foreach (Sage.Entity.Interfaces.IOwnerRights right in ownr.Rights)
{
if (right.User == Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser && right.Owner.Type == Sage.Entity.Interfaces.OwnerType.Department)
{
accountingUser = true;
break;
}
}
Teams:
System.Collections.Generic.IList<Sage.Entity.Interfaces.IOwner> teamlist = Sage.SalesLogix.Security.Owner.GetTeamsByUser(Sage.SalesLogix.API.MySlx.Security.CurrentSalesLogixUser);
foreach (Sage.Entity.Interfaces.IOwner team in teamlist)
{
if (team.Type==Sage.Entity.Interfaces.OwnerType.Department && team.OwnerDescription.ToLower().Contains("accounting"))
{
accountingUser = true;
break;
}
}



