Please contact the appropriate software vendor or IT professional for assistance with this process or issue, which is beyond Blackbaud's scope of support.

An interop assembly is required in order to use Blackbaud's objects from .NET code. An interop assembly is a .NET DLL that exposes the type information and metadata from a COM component in a format that .NET managed code can understand. It can be thought of as a mapping layer between the .NET and COM code.

NOTE: You can also access The Raiser's Edge API by referencing Blackbaud.PIA.RE7.BBREAPI.dll in the C:\Program Files\Blackbaud\The Raisers Edge 7\PIA directory. You will need to explicitly import the  Blackbaud.PIA.RE7.BBREAPI namespace into your project files.  Without this, your project will not be able to implicitly determine what namespace to which an API object belongs.  Place this line at the top of your API project file:

Imports Blackbaud.PIA.RE7.BBREAPI


The following is an example that demonstrates building an interop assembly:

The entire Raiser's Edge COM API is exposed by a type library named BBREAPI7.TLB. The .NET Framework ships with a special utility named TLBIMP, which generates an interop assembly. To generate it, change to the RE7\tlb directory and issue the following command from the console:

tlbimp BBREAPI7.tlb /out: REDotNetAPI.dll

example that demonstrates building an interop assembly

At this point, you have an assembly you may reference in your .NET code to gain full access to the Raiser's Edge API.

Note: The mechanics of this process are the same for The Financial Edge and The Education Edge except the input TLB filename is bbafnAPI7.TLB, bbEEAPI7.TLB, or bbPYAPI7.TLB, depending on which product API you wish to reference.
 

Building a simple VB.NET console-based application that exercises Blackbaud's API:

This application connects to The Raiser's Edge and lists the names of all funds in the database. It is not important to be 100% familiar with the syntax of the program, rather, the sample is included to demonstrate how straightforward the process of using Blackbaud's API from a .NET Framework application is. A key point is the semantics of using Blackbaud's API under .NET are unchanged from using it in a traditional COM development tool like Visual Basic 6.


' Simple VB.NET RE:API Sample Application
' Author: Blackbaud, Inc.

Imports System
Imports REDotNetAPI ' Make the REDotNetAPI accessible from our code

Module TestRE

   ' Note: error handling is omitted for clarity
   Sub Main()

       Dim RE7 As REAPI = New REAPI()
       ' Initialize the API
       If RE7.Init("WRE11111", "Supervisor", "admin", _
                   DatabaseNumber:=50, lAppMode:=AppMode.amServer) Then

           Console.WriteLine("API Initialized!")

           ' Create an instance of RE's Funds Collection Class
           Dim oFunds As New CFunds()
           oFunds.Init(RE7.SessionContext)

           Dim oFund As CFund
           ' Iterate over all funds in the system
           For Each oFund In oFunds
               ' Print the description of each fund to the console
               Console.WriteLine("Fund: " & oFund.Fields(EfundFields.Fund_fld_DESCRIPTION))
               ' Free up any resources held by this object
               oFund.CloseDown()
           Next oFund

           ' Free up any resources held by this object
           oFunds.CloseDown()
       Else
           Console.WriteLine("Unable to initialize. " & _
               "Error code = " & RE7.SessionContext.ErrorObject.ErrorDescription())
           Exit Sub
       End If
   End Sub
End Module

Note: The most important line is the Imports REDotNetAPI statement. This instructs the compiler to expose Blackbaud's API functionality to the .NET code. Assuming the .NET framework is installed on your machine:

    • Create a file named TestRE.VB and enter the source code above
    • To build the program, change to the same directory in which you created the REDotNetAPI.DLL interop assembly and issue the following command from the command line:

       VBC TestRE.vb /target:exe /r:REDotNetAPI.dll

      This invokes the VB.NET compiler and builds our application. Note the boldface type. This instructs the compiler to reference the COM interop DLL just built. The compiler uses the interop assembly to resolve the Blackbaud API types and creates the appropriate metadata required by the .NET Framework to work its COM Interop magic when the program is run.
    The following is a sample session, demonstrating the compilation process.

    sample session

    The following is a sample run of our program against The Raiser's Edge sample database.

    sample run of our program against The Raiser's Edge sample database

    Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.