Sample code to hide out of the box reports using ReportVisibility class in Dynamics 365

Recently we wanted to hide OOB reports for our users.

One way of doing it is either change those report from Organization owned to personal

or change the Display in Area for those reports (this will hide those reports from all other views except the “All Reports, Including Sub Reports” view), as all other OOB Views for the reports uses the Reports Area filter. Another option of course is to update the filter criteria for those views or deactivate those views.

In our case, we simply updated the Display In property for all the OOB reports. Below is the sample code that we used. Basically, every report can have 0 or more (max 3) related Report Visibility records associated to it. (i.e. for forms, lists or reports area). In the below code we have looped through all the OOB reports and deleted all the associated ReportVisibility records for that report.

Hope it helps..


Author: Nishant Rana

I love working in and sharing everything about Microsoft.NET technology !

Share your thoughts

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.