Code Table Example: WebAPI.dll (Visual Studio)

The entire code sample can be found here: CodeTableExample.zip

Step 1 -  Create a WinForm project with references to AppFxWebService.dll and to Blackbaud.AppFx.XmlTypes.dll and System.Web.Services.dll.

This is described in Example: Consume the Blackbaud AppFx Web Service with a .NET WinForms Client Application.

Step 2 -  Add code to the form to support an Infinity client application.

This is described in Example: Consume the Blackbaud AppFx Web Service with a .NET WinForms Client Application. See the project ZIP file or Before Coding Code Table: WebAPI.dll (Visual Studio) for details.

Step 3 -  Add a Label and ComboBox to the default form.

Rename the Label and ComboBox appropriately.

LabelAddressType

ComboBoxAddressType

Add text to the label. In this case, the combo box will support selecting an Address Type.

Step 4 -  Find the endpoint operation to get the list of entries in the Address Type code table.

Use the Endpoint Reference to find the endpoint operation that gets a list of entries for a given code table.

AppFxWebService

CodeTableEntryGetList

Step 5 -  Find the feature identifier to supply to the endpoint operation.

For a discussion about feature metadata, see Feature Metadata.

  1. Browse to AdministrationApplicationFeatures.

  2. Click Code table search.

  3. Search for the Address Type code table.

  4. Select the result. The page that describes the code table appears.

  5. Copy the Database table name: ADDRESSTYPECODE.

Step 6 -  Create the request and reply.

  1. In the form's load procedure, add a request and reply to get the list of entries in the code table. The request and reply objects reflect the name of the endpoint operation: CodeTableEntryGetListRequest and CodeTableEntryGetListReply.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            InitializeAppFxWebService()
            Dim req = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListRequest()
            Dim reply = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListReply()
            req.CodeTableName = "ADDRESSTYPECODE"
            req.ClientAppInfo = _clientAppInfoHeader
            reply = _appFx.CodeTableEntryGetList(req)
            For Each row In reply.Rows
                ComboBoxAddressType.Items.Add(row.Code)
            Next
        End Sub
  2. To CodeTableName for the request, assign ADDRESSTYPECODE, which is the database table name you retrieved from the shell.

    You can also specify other options. See the following snippet from the Endpoint Reference.

      <soap12:Body>
        <CodeTableEntryGetListRequest xmlns="Blackbaud.AppFx.WebService.API.1">
          <CodeTableName>string</CodeTableName>
          <IncludeInactive>boolean</IncludeInactive>
          <RefreshCache>boolean</RefreshCache>
          <ReturnListSortMethod>boolean</ReturnListSortMethod>
          <UseCodeTableEntrySecurity>boolean</UseCodeTableEntrySecurity>
        </CodeTableEntryGetListRequest>
      </soap12:Body>
    </soap12:Envelope>
  3. Add ClientAppInfo to the request. The Infinity application requires information such as which database to use.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            InitializeAppFxWebService()
            Dim req = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListRequest()
            Dim reply = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListReply()
            req.CodeTableName = "ADDRESSTYPECODE"
            req.ClientAppInfo = _clientAppInfoHeader
            reply = _appFx.CodeTableEntryGetList(req)
            For Each row In reply.Rows
                ComboBoxAddressType.Items.Add(row.Code)
            Next
        End Sub
  4. Invoke the request.

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            InitializeAppFxWebService()
            Dim req = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListRequest()
            Dim reply = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListReply()
            req.CodeTableName = "ADDRESSTYPECODE"
            req.ClientAppInfo = _clientAppInfoHeader
            reply = _appFx.CodeTableEntryGetList(req)
            For Each row In reply.Rows
                ComboBoxAddressType.Items.Add(row.Code)
            Next
        End Sub

Step 7 -  Populate the combo box with the list from the reply.

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeAppFxWebService()
        Dim req = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListRequest()
        Dim reply = New Blackbaud.AppFx.WebAPI.ServiceProxy.CodeTableEntryGetListReply()
        req.CodeTableName = "ADDRESSTYPECODE"
        req.ClientAppInfo = _clientAppInfoHeader
        reply = _appFx.CodeTableEntryGetList(req)
        For Each row In reply.Rows
            ComboBoxAddressType.Items.Add(row.Code)
        Next
    End Sub