Skip to content

Sample of a Dataverse plugin used with Project Power Apps and Project for the Web plugin to block users from deleting projects.

License

Notifications You must be signed in to change notification settings

OfficeDev/Project-Dataverse-Plugin-Sample

Repository files navigation

Dataverse Plugin to Block Project Deletion

In Project for the Web, any user that has a project shared with them can delete the entire project, without being able to revert the deletion if this was done by accident. Teammates can also delete shared projects without having a project license when using Project Power Apps.

To limit this from happening, you can use Dataverse plug-ins to disable the delete operation on projects for a user based on any Dataverse condition that you determine. In the plug-in in this example, we will be removing the delete permission from a user that is not in a specific Team in Dataverse. Dataverse Teams can be backed by a M365 Group or created manually.

Scenario

As a Dataverse Admin, I want to limit who has permissions to delete projects in Project Power Apps and Project for the Web.

Prerequisites

To use this code sample, you need the Official Dataverse plug-in pre-requisites, which you can find here.

How to use this solution

Please visit the Official documentation to Write a Dataverse Plug-in for latest updates. A step-by step to use this sample plug-in is provided below for convenience.

IMPORTANT: In the ProjectBlockDeletePlugin.cs file where commented TODO, you need to manually enter the Team Id give delete privileges to. You can find these in Power Apps Data Explorer.

  1. Sign the Assembly:
    • Right click the project in your Solution Explorer and press Properties.
    • Go to the Signing tab, check Sign the assembly, Choose <New…> from the dropdown options and name your signature. Password is optional.
  2. Build your solution by right clicking the project in your Solution Explorer and pressing Build.
  3. Launch the Plugin Registration Tool (installed in Prerequisites).
  4. Press the Create New Connection button at the top left and enter the account from which you want to register the plugin to Dataverse.
  5. Register a new assembly.
  6. Load the assembly from the .dll previously built, which is stored in your project’s Debug folder.
  7. Press Register Selected Plugins.
  8. Find your Plugin Assembly in the list of Registered Plugins and right click to Register a new Step.
  9. Register the step with the following changes:
    • Message: Delete
    • Primary Entity: msdyn_project
    • Event Pipeline Stage of Execution: PreValidation
  10. We’re done! You can now test manually in Project Power Apps and Project for the Web to verify functionality.

Additional resources

Copyright

Copyright (c) 2016 Microsoft. All rights reserved.

About

Sample of a Dataverse plugin used with Project Power Apps and Project for the Web plugin to block users from deleting projects.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages