Readme_Active Directory Data Processing Extension Sample
This sample works only with SQL Server 2008 R2. It will not work with any version of SQL Server earlier than SQL Server 2008 R2.
ADDataExtension is a data processing extension for Active Directory. The sample uses the data processing extension interfaces as well as other Microsoft .NET Framework classes. The naming convention used for the sample is the prefix "AD", for Active Directory information. This sample is not supported on Itanium-based operating systems.
| Important: |
| Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator. |
You should be familiar with Visual Studio and either Microsoft Visual C# or Microsoft Visual Basic, and you should have the following installed to use the ADDataExtension sample:
- Microsoft Visual Studio 2008 or compatible development environment (for viewing the project files).
- Microsoft SQL Server 2008 R2, including Reporting Services.
- Microsoft .NET Framework 2.0.
- Reporting Services samples. You can choose to install the samples during SQL Server setup. For this release, when you choose to install samples, a separate installer is installed on your computer that you can start to extract and install samples. You can run this installer from the Start menu in the Microsoft SQL Server program group.
- A report server that you have permission to access on your network, if you plan to use the sample extension to add more data processing functionality to your server.
| Important: |
| SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases. |
By default, this sample is located in the following directory:
C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\ Extension
Building the Sample
Follow these steps to build the sample.
If you have not already created a strong name key file, generate the key file using the following instructions.
To generate a strong name key file
- Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.-- or --Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
- Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: To determine the folder where samples are located, click the Start* button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.*
- At the command prompt, run the following command to generate the key file: sn -k SampleKey.snk Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To compile the sample using the .NET Framework SDK
- Copy Microsoft.ReportingServices.Interfaces.dll from the report server \bin directory into your samples folder.
- Issue the following commands to create the sample data processing extension Microsoft.Samples.ReportingServices.ADDataExtension.dll. * csc.exe /t:library /out:Microsoft.Samples.ReportingServices.ADDataExtension.dll *.cs .\properties\*.cs /res:.\properties\Resources.resx /r:Microsoft.ReportingServices.Interfaces.dll *
To compile the sample using Visual Studio .NET
- Open the ADDataExtension solution file (ADDataExtensionCS.sln or ADDataExtensionVB.sln) in Visual Studio 2008 (or later).
- In Solution Explorer, select the ADDataExtension project.
- On the Project menu, click Add Reference.
- On the Add References dialog box, click the .NET tab.
- Click Browse, and navigate to find Microsoft.ReportingServices.Interfaces on your local drive. By default, the assembly is located in the ReportServer\bin directory. Click OK. The selected reference is added to your project. Note: The reference may already be added to your project. If this is the case, you do not have to re-add a reference.
- On the Build menu, click Build Solution.
Deploying the Sample
After you have completed the previous steps, Microsoft.Samples.ReportingServices.ADDataExtension.dll can be deployed to a report server or to Report Designer for use in running reports against a custom data source.
To deploy the sample
- Copy Microsoft.Samples.ReportingServices.ADDataExtension.dll to the report server. The default location for report server extensions is C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin.
- Copy the assembly to Report Designer. The default location for extensions for Report Designer is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.
- Add the following entry to both the RSReportServer.config and RSReportDesigner.config files under the Data element (the default location of the RSReportDesigner.config file is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies, and the default location for the RSReportServer.config file is C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer): * <Extension Name="AD" Type=" Microsoft.Samples.ReportingServices.ADDataExtension.ADConnection,Microsoft.Samples.ReportingServices.ADDataExtension"/> *
- To enable the generic query designer for the sample data processing extension, add the following entry to the RSReportDesigner.config file under the Designer element. * <Extension Name="AD" Type="Microsoft.ReportingServices.QueryDesigners.GenericQueryDesigner,Microsoft.ReportingServices.QueryDesigners"/> For more information about deploying data processing extensions, see Deploying a Data Processing Extension*.
To configure code access security for the sample
- Open the report server policy configuration file (rssrvpolicy.config). The default location for this file is C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer.
- Data processing extensions must be granted full trust. To do this, add the following code group information to the end of the code groups section in the configuration file: * <CodeGroup class="UnionCodeGroup"
Description="Code group for my Active Directory data processing extension">
Url="C:\Program Files\Microsoft SQL Server\MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices. ADDataExtension.dll"
- If you are using the sample data processing extension in Report Designer, repeat steps 1 and 2 using the Report Designer preview policy configuration file (rspreviewpolicy.config) and the following code group: * <CodeGroup class="UnionCodeGroup"
Name=" ADCodeGroup "
Description="Code group for my Active Directory data processing extension">
Url="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.Samples.ReportingServices. ADDataExtension.dll"
</CodeGroup> The default location for the rspreviewpolicy.config file is C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.For more information about .NET Framework security and Reporting Services, see Secure Development (Reporting Services)*.
Creating a Report That Uses ADDataExtension
This section contains a quick walkthrough showing how to create a sample report that uses the sample data extension.
| Note: |
| You must deploy the sample Active Directory data extension to Report Designer and to the report server before creating a report. You must also enable the generic query designer for the extension. For more information, see "Deploying ADDataExtension" earlier in this topic. |
To create the report project
- Click Start, point to Programs, point to Microsoft SQL Server 2008 R2, and then click Business Intelligence Development Studio.
- On the File menu, point to New, and then click Project.
- In the Project Types list, click Business Intelligence Projects.
- In the Templates list, click Report Server Project.
- In Name, type ADReportProject.
- Click OK to create the report project.
To create the report
- On the Project menu, click Add New Item.
- In the Categories list, click Report Project.
- In the Templates list, click Report.
- In the Name box, type ADReport, and then click Open.
To add a data source that uses the sample data extension
- In the Design pane, click Click here to create a data source and data set for your report.
- On the General tab, in the Name text box, type ADDataSource.
- In the Type list, select Active Directory Information.
- Leave ConnectionString empty. The sample data extension does not use a connection string.
- On the Credentials tab, click one of the server logon types. You may enter the user name and password for the Windows that your sample data extension will be accessing. Click Use Windows Authentication (Integrated Security), click use a specific username and password, and enter credentials, or click prompt for credentials and enter a prompt string. Security Note: Whenever possible, use Windows Authentication. You will be prompted for network credentials any time that you try to access Active Directory, except when your credentials have been cached.
- Click Next to save the data source.
- The generic query designer tab is displayed. From Command Type, select Text. Type the query string we use for retrieving the data from Active Directory.
- On the toolbar of the generic query designer, click the Run (!) button. The data requested from Active Directory is displayed.
To design the report layout
- In the Design view, in the Toolbox, click Table.
- Drag the Table control onto the design surface.
- From the Report Data pane, drag columns to the cells in the Data row. Add fields to the table as needed.
To preview the report
- Click the Preview tab to preview the report. Depending on your credential settings for your ADDataSource, you may be required to enter a user name and password.
Compiling and Running Code Examples Reporting Services Samples
Extension Samples (Reporting Services) Implementing a Data Processing Extension
Help and Information
- Getting SQL Server 2008 R2 Assistance* © 2011 Microsoft Corporation. All rights reserved.