This project is read-only.

Readme_Active Directory Data Processing Extension Sample

11/05/2008 21:36:06

This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
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.

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, 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.
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 Samples\FindRenderSave Sample

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
  1. 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.
  2. 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.*
  3. 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
  1. Copy Microsoft.ReportingServices.Interfaces.dll from the report server \bin directory into your samples folder.
  2. 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
  1. Open the ADDataExtension solution file (ADDataExtensionCS.sln or ADDataExtensionVB.sln) in Visual Studio 2008.
  2. In Solution Explorer, select the ADDataExtension project.
  3. On the Project menu, click Add Reference.
  4. On the Add References dialog box, click the .NET tab.
  5. 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.
  6. 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
  1. 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.MSSQLSERVER\Reporting Services\ReportServer\bin.
  2. 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.
  3. 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"/> *
  4. 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
  1. 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.
  2. 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">
    <IMembershipCondition class="UrlMembershipCondition"
    Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices. ADDataExtension.dll"
    </CodeGroup> *
    1. 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">
      <IMembershipCondition class="UrlMembershipCondition"
      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.

      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
      1. Click Start, point to Programs, point to Microsoft SQL Server 2008, and then click Business Intelligence Development Studio.
      2. On the File menu, point to New, and then click Project.
      3. In the Project Types list, click Business Intelligence Projects.
      4. In the Templates list, click Report Server Project.
      5. In Name, type ADReportProject.
      6. Click OK to create the report project.
      To create the report
      1. On the Project menu, click Add New Item.
      2. In the Categories list, click Report Project.
      3. In the Templates list, click Report.
      4. In the Name box, type ADReport, and then click Open.
      To add a data source that uses the sample data extension
      1. In the Design pane, click Click here to create a data source and data set for your report.
      2. On the General tab, in the Name text box, type ADDataSource.
      3. In the Type list, select Active Directory Information.
      4. Leave ConnectionString empty. The sample data extension does not use a connection string.
      5. 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.
      6. Click Next to save the data source.
      7. 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.
      8. 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
      1. In the Design view, in the Toolbox, click Table.
      2. Drag the Table control onto the design surface.
      3. 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
      1. 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.

      See Also

      Compiling and Running Code Examples Reporting Services Samples
      Other Resources
      Extension Samples (Reporting Services) Implementing a Data Processing Extension
      Help and Information
      • Getting SQL Server 2008 Assistance* © 2008 Microsoft Corporation. All rights reserved.

Last edited Nov 6, 2008 at 11:08 PM by bonniefe, version 2


No comments yet.