Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

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

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

  • Suggested answer
    Emre GULCAN Profile Picture
    Emre GULCAN 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);


  • JayeshAC Profile Picture
    JayeshAC 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
    Gopalan Bhuvanesh Profile Picture
    Gopalan Bhuvanesh 11,397 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

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans