Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IFtpProviderConstruct::Construct Method
Collapse the table of content
Expand the table of content

IFtpProviderConstruct::Construct Method

IIS 7.0

Retrieves an array of key/value pairs from an FTP provider's configuration settings in the IIS ApplicationHost.config file.

HRESULT Construct(
   SAFEARRAY * configurationEntries
)

Term

Definition

configurationEntries

[IN] A pointer to a SAFEARRAY that contains key/value pairs from the IIS configuration settings.

An HRESULT. Possible values include, but are not limited to, those in the following table.

Value

Description

S_OK

Indicates that the operation was successful.

You can specify parameters for an FTP provider in the IIS ApplicationHost.config file by adding an <activation> collection, which may contain a series of <providerData> elements that list additional settings for custom FTP providers. Each <providerData> element is paired with an entry in the <providerDefinitions> collection, and contains a series of key/value pairs that contain information that is specific to each provider.

The following configuration excerpt illustrates a custom FTP provider entry in the ApplicationHost.config file and its related information.

<system.ftpServer>
   <providerDefinitions>
      <add name="FtpDemo"
         clsid="FtpDemo.DemoProvider" />
      <activation>
         <providerData name="FtpDemo">
            <add key="one" value="1" />
            <add key="two" value="2" />
         </providerData>
      </activation>
   </providerDefinitions>
</system.ftpServer>

The following code example iterates through the array of configuration settings and sends the key/value pairs to the debug stream.

public:
   STDMETHOD(Construct)(SAFEARRAY * configurationEntries)
   {
      CONFIGURATION_ENTRY * pArray;
      HRESULT hr = S_OK;
      LONG lLbound = 0;
      LONG lUbound = 0;

      OutputDebugString(L"IFtpProviderConstruct::Construct\n");

      // Retrieve the upper and lower bounds for the configuration array.
      SafeArrayGetLBound( configurationEntries, 1, &lLbound );
      SafeArrayGetUBound( configurationEntries, 1, &lUbound );

      // Retrieve a pointer to the array of configuration settings.
      hr = SafeArrayAccessData(configurationEntries, (void**)&pArray);
      // Return an error if a failure occurs.
      if (FAILED(hr))
      {
         return hr;
      }

      // Loop through the array of configuration setttings and
      // output the key/value pairs to the debug channel.
      for(LONG Index = lLbound; Index <= lUbound; Index ++)
      {
         OutputDebugString(pArray[Index].bstrKey);
         OutputDebugString(pArray[Index].bstrValue);
      }

      // Release the pointer to the array of configuration settings.
      hr = SafeArrayUnaccessData(configurationEntries);
      // Return an error if a failure occurs.
      if (FAILED(hr))
      {
         return hr;
      }

      return S_OK;
   }

Type

Description

Client

IIS 7.5

Server

IIS 7.5

Product

FTP 7.5

Reference

ftpext.tlb

Community Additions

ADD
Show:
© 2015 Microsoft