Readme_File Share Data Processing Extension Sample

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.

FsiDataExtension is a simple data processing extension for the Windows file system. It uses the Microsoft .NET Framework library classes System.IO.DirectoryInfo and System.IO.FileSystemInfo to query the contents of any valid network file share. The sample uses the data processing extension interfaces as well as other .NET Framework classes. The naming convention used for the sample is the prefix "Fsi", for File Share 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.

Requirements

You should be familiar with Microsoft Visual Studio and either Microsoft Visual C# or Microsoft Visual Basic, and you should have the following installed to use the FsiDataExtension sample:

  • Microsoft Visual Studio 2005 or compatible development environment (for viewing the project files).
  • Microsoft SQL Server, 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.

Location

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.FsiDataExtension.dll.

    csc.exe /t:library /out:Microsoft.Samples.ReportingServices.FsiDataExtension.dll *.cs .\properties\*.cs /res:.\properties\Resources.resx  /r:Microsoft.ReportingServices.Interfaces.dll
    

To compile the sample using Visual Studio .NET

  1. Open the FsiDataExtension solution file (FsiDataExtensionCS.sln or FsiDataExtensionVB.sln) in Visual Studio 2005.

  2. In Solution Explorer, select the FsiDataExtension 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.FsiDataExtension.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.FsiDataExtension.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="FSI" Type="Microsoft.Samples.ReportingServices.FsiDataExtension.FsiConnection,Microsoft.Samples.ReportingServices.FsiDataExtension"/>
    
  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="FSI" 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"
       version="1"
       PermissionSetName="FullTrust"
       Name="FSICodeGroup"
       Description="Code group for my FSI data processing extension">
          <IMembershipCondition class="UrlMembershipCondition"
             version="1"
             Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.FsiDataExtension.dll"
           />
    </CodeGroup>
    
  3. 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"
       version="1"
       PermissionSetName="FullTrust"
       Name="FSICodeGroup"
       Description="Code group for my FSI data processing extension">
          <IMembershipCondition class="UrlMembershipCondition"
             version="1"
             Url="C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\Microsoft.Samples.ReportingServices.FsiDataExtension.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 FsiDataExtension

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 file share 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 FsiDataExtension" 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 FsiReportProject.

  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 FsiReport, and then click Open.

To add a data source that uses the sample data extension

  1. In the Data pane, click New, and then select New Dataset.

  2. On the Query tab, in the Name text box, type FsiDataSource.

  3. In the Type list, select File Share 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 file share 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.

    ms160918.security(en-us,SQL.100).gifSecurity Note:
    Whenever possible, use Windows Authentication. You will be prompted for network credentials any time that you try to access a network file share, except when your credentials have been cached.

  6. Click OK to save the data source.

To view the dataset

  1. In the Data view, the generic query designer is displayed. From Command Type, select Text.

  2. In the query pane directly below the toolbar of the generic query designer, type the path of a network file share available on your network. For example, type \\Computer1\Public.

  3. On the toolbar of the generic query designer, click the Run (!) button.

    The file share data will appear in the details pane.

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 the Name box to the first cell in the Detail 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 FsiDataSource, you may be required to enter a user name and password.

See Also

Tasks

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