0

I am following this walkthrough for getting the access of a user to an account in dynamics crm using C#. When I tried to check that if user have AppendAccess it is not working properly and while debugging I found these rights in the following form. enter image description here

I want to check if a user have AppendAccess then do the next. what I tried is in the following:

if(principalAccessRes.AccessRights.Equal("AppendAccess "))
{
Console.WriteLine("User have Append Access");
}
User089
  • 139
  • 3
  • 14
  • 1
    AccessRights is a [Flags] enum. So, this is answered by [How to Compare Flags in C#?](http://stackoverflow.com/questions/40211/how-to-compare-flags-in-c) – Alex Oct 16 '15 at 14:34

1 Answers1

0

Because AccessRights is a [Flag] you need to check if the access rights response includes (HAVE) instead of equal.

if(principalAccessRes.AccessRights.HasFlag(AccessRights.AppendAccess))
{
   Console.WriteLine("User have Append Access");
}
Nicknow
  • 7,154
  • 3
  • 22
  • 38