Compartilhar via


Step 3: Deploying and Enabling UDFs

In this step, you will:

  1. Implante SampleUdf.dll, que você criou na Etapa 2: Criando um Managed-Code UDF, em uma pasta em um computador que tem o Microsoft SharePoint Server 2010 instalado.

  2. Allow user-defined functions (UDFs) to be called from a specific trusted location, for example, trusted Shared Documents location.

  3. Enable SampleUdf.dll.

Deploying UDFs

To deploy UDFs

  1. Create a folder named "UDFs" on the local drive of the computer to which you want to deploy UDFs. Por exemplo, "C:\UDFs".

  2. Copy the SampleUdf.dll assembly.

  3. Salve SampleUdf.dll em "C:\UDFs".

Trusting a Location

To trust a location

  1. No menu Iniciar, clique em Todos os Programas.

  2. Point to Microsoft SharePoint 2010 Products and click SharePoint Central Administration.

  3. Under Application Management click Manage service applications.

  4. On the Manage Service Applications page, click Excel Services Application.

  5. On the Excel Services Application page, click Trusted File Locations.

  6. Na página Locais de Arquivo Confiáveis, clique em Adicionar Local de Arquivo Confiável.

  7. On the Add Trusted File Location page, in the Address box, type the location where you will save your workbook—for example, http://MyServer002/Shared%20Documents.

  8. Under Location type, click the appropriate location type. In this example, select Microsoft SharePoint Foundation.

  9. Under Trust Children, select Children trusted to trust child libraries or directories.

  10. Under Allow User-Defined Functions, select User-defined functions allowed to allow UDFs to be called from workbooks stored in this trusted location.

  11. Clique em OK.

Enabling UDFs

To do the following steps, you need a computer that has SharePoint Server 2010 installed.

To enable UDFs

  1. Follow steps 1 through 3 in the previous procedure ("To trust a location") to display the Shared Services home page for an SSP.

  2. Under Excel Services Settings, click User-defined function assemblies.

  3. Na página Serviços do Excel User-Defined Functions, clique em Adicionar User-Defined Função para abrir a página Adicionar User-Defined Assembly de Funções do ExcelServices.

  4. In the Assembly box, type the path to the SampleUdf.dll assembly. Neste exemplo, seria C:\UDFs\SampleUdf.dll.

  5. Under Assembly Location, click File path.

  6. Under Enable Assembly, the Assembly enabled check box should be selected by default.

  7. Clique em OK.

Programação robusta

If the AllowUdfs value is false when a session is started on a workbook that has UDF calls, the UDF calls will fail.

Observação

[!OBSERVAçãO] The AllowUdfs flag is denoted by the User-defined functions allowed option (see step 9 in the "Trusting a Location" section).

If you change the AllowUdfs value to true after a session has started, the UDF calls will also fail. This is because changes in the AllowUdfs flag take effect on the next session. You can get around this by resetting Microsoft Internet Information Services (IIS). Resetting IIS will reload UDFs.

Para obter mais informações sobre como redefinir o IIS, consulte Como habilitar UDFs.

Confira também