web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

How to update/change access privilege in security role in C#?

(0) ShareShare
ReportReport
Posted on by 1,157

Hi All,

I want to update/change the access privilege to user/BU/Org level in security role through C#.

For example: On button click, user will be able to change 'Enable or Disable User' access privilege to 'Organization' level.

Do we have any CRM Api which i can use to update the security role or any other method?

Thanks,

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Gopalan Bhuvanesh Profile Picture
    11,401 on at
    RE: How to update/change access privilege in security role in C#?

    Hi

    Try AddPrivilegesRoleRequest

    Please refer the following:

    stackoverflow.com/.../update-crm-2011-access-right-programmatically

    msdn.microsoft.com/.../microsoft.crm.sdk.messages.addprivilegesrolerequest.aspx

  • JayeshAC Profile Picture
    1,157 on at
    RE: How to update/change access privilege in security role in C#?

    Hi Gopalan,

    Thanks for your reply.

    I already have checked this links where they have mentioned how to copy the security role from one to another. However, i want to update/change the existing role through C#.

    Please suggest if you have any idea.

  • Suggested answer
    Emre GULCAN Profile Picture
    2,379 on at
    RE: How to update/change access privilege in security role in C#?

    Hi,

    You should use "AddPrivilegesRoleRequest" or "ReplacePrivilegesRoleRequest" in SDK messages.

    You can also use XrmLibrary 's RoleHelper methods just 2 lines of code like this;

    RoleHelper helper = new RoleHelper(_organizationService);
    helper.AddPrivilege(Guid.Parse("role id"), "privilege name (prv_XXXX)", PrivilegeDepth.Basic);
    helper.ReplacePrivileges(Guid.Parse("role id"), privilegeList);


Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans