1cf0596431abe92a248f0e33317f03e5c7633bd3
API/CodeSamples/SharedWithValues.md
| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | +#SharedWithValues |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | + |
|
| 7 | +This sets the list of users or roles available in the "Shared With" dropdown of the Misc tab in the Report Designer. This is usually set per-user and may be fine-tuned to your organization's needs. While this setting doesn't have any immediate effect on what reports a user can see, the [[CurrentUserRoles|/API/CodeSamples/CurrentUserRoles]] and [[CurrentUserName|/API/CodeSamples/CurrentUserName]] properties are used in conjunction with this property to create report-level security. |
|
| 8 | + |
|
| 9 | +**Default Value:** null/Nothing |
|
| 10 | + |
|
| 11 | +##Global.asax (C♯) |
|
| 12 | + |
|
| 13 | +```csharp |
|
| 14 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 15 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 16 | +{ |
|
| 17 | + // Configure settings |
|
| 18 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 19 | + public static void InitializeReporting() { |
|
| 20 | + //Check to see if we've already initialized. |
|
| 21 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 22 | + return; |
|
| 23 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 24 | + //Creates a connection to Microsoft SQL Server |
|
| 25 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 26 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 27 | + AdHocSettings.SharedWithValues = new string[] {"Marketing", "Sales", "Bob", "Alice", "Dan"}; //The relevant setting |
|
| 28 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 29 | + } |
|
| 30 | +} |
|
| 31 | + |
|
| 32 | +``` |
|
| 33 | + |
|
| 34 | +##Global.asax (VB.NET) |
|
| 35 | + |
|
| 36 | +```visualbasic |
|
| 37 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 38 | +Public Class CustomAdHocConfig |
|
| 39 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 40 | + |
|
| 41 | + Shared Sub InitializeReporting() |
|
| 42 | + 'Check to see if we've already initialized |
|
| 43 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 44 | + Return |
|
| 45 | + 'Initialize System |
|
| 46 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 47 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 48 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 49 | + AdHocSettings.SharedWithValues = New String() {"Marketing", "Sales", "Bob", "Alice", "Dan"} 'The relevant setting |
|
| 50 | + HttpContext.Current.Session("ReportingInitialized") = True |
|
| 51 | + End Sub |
|
| 52 | +End Class |
|
| 53 | +``` |
|
| 54 | + |
|
| 55 | +##Screenshots |
|
| 56 | + |
|
| 57 | +AdHocSettings.SharedWithValues = new string[] {"Marketing", "Sales", "Bob", "Alice", "Dan"} |
|
| 58 | + |
|
| 59 | + |
|
| ... | ... | \ No newline at end of file |