Step 3: Deploying and Enabling UDFs

In this step, you will:

  1. Deploy SampleUdf.dll, which you created in Step 2: Creating a Managed-Code UDF, to a folder on a computer that has Microsoft Office SharePoint Server 2007 installed.

  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. For example, "C:\UDFs".

  2. Copy the SampleUdf.dll assembly.

  3. Save SampleUdf.dll in "C:\UDFs".

Trusting a Location

To trust a location

  1. On the Start menu, click All Programs.

  2. Point to Microsoft Office Server and click SharePoint 3.0 Central Administration.

  3. On the Quick Launch, click your Shared Services Provider (SSP) link—for example, "SharedServices1"—to view the Shared Services home page for that particular SSP.

  4. On the Shared Services home page, in the Excel Services Settings section, click Trusted file locations.

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

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

  7. Under Location type, click the appropriate location type. In this example, select Windows SharePoint Services.

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

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

  10. Click OK.

Enabling UDFs

To do the following steps, you need a computer that has Office SharePoint Server 2007 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. On the Excel Services User-Defined Functions page, click Add User-Defined Function to open the Excel****Services Add User-Defined Function Assembly page.

  4. In the Assembly box, type the path to the SampleUdf.dll assembly. In this example, it would be 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. Click OK.

Robust Programming

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

Note

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.

For more information about resetting IIS, see How to: Enable UDFs.

See Also

Tasks

Step 1: Creating a Project and Adding a UDF Reference
Step 2: Creating a Managed-Code UDF
Step 4: Testing and Calling UDFs from Cells
How to: Enable UDFs

Concepts

Walkthrough: Developing a Managed-Code UDF
Understanding Excel Services UDFs