Condividi tramite


How to: Enable an External Application Provider

Applies to: SharePoint Foundation 2010

A server farm administrator must set the SPWebService.ExternalApplicationSettings.Enabled property to true to enable management of external applications by an External Application Provider (EAP). When the property is set, the EAP specified in the ExternalApplicationSettings.Provider property becomes the manager of all external applications in all Web applications within the Web service. Unless the provider has been set to something else, a default provider that is built into SharePoint Foundation is used.

The property cannot be set in the UI, so a server farm administrator must do this programmatically. The following shows the C# code. (Note that you must call Update() to persist the change to the configuration database.)

SPWebService.ContentService.ExternalApplicationSettings.Enabled = true;
SPWebService.ContentService.Update(); 
SPWebService.ContentService.ExternalApplicationSettings.Enabled = True
SPWebService.ContentService.Update()

The server farm administrator can use the Windows PowerShell Add-Type cmdlet to run the code (see below) or you can provide the server farm administrator with a utility. In theory, this code could be in a console application, a custom PowerShell cmdlet, the Click event handler for a control on an application page, or any other form of executable code. However, it is probably simplest for the administrator to use Add-Type. The following shows one way to do this, by creating a Windows PowerShell script.

To Create and Run a Windows PowerShell Script that Uses Add-Type to Enable an EAP

  1. Add the following to a text file.

    Add-type @"
    using System;
    using Microsoft.SharePoint.Administration;
    
    namespace ContosoCmdlets
    
        public class EAPEnabler
        {
            public static void EnableEAP()
            {
                SPWebService.ContentService.ExternalApplicationSettings.Enabled = true;
                SPWebService.ContentService.Update(); 
            }
        }
    "@ -Language CsharpVersion3
    [ContosoCmdlets.EAPEnabler]::EnableEAP()
    
  2. Save the file as EAPEnable.ps.

  3. Run the script in a Windows PowerShell window.