Step 3: Deploying and Enabling UDFs
Applies to: SharePoint Server 2010
In this article
Trusting a Location
In this step, you will:
Deploy SampleUdf.dll, which you created in Step 2: Creating a Managed-Code UDF, to a folder on a computer that has Microsoft SharePoint Server 2010 installed.
Allow user-defined functions (UDFs) to be called from a specific trusted location, for example, trusted Shared Documents location.
To deploy UDFs
Create a folder named "UDFs" on the local drive of the computer to which you want to deploy UDFs. For example, "C:\UDFs".
Copy the SampleUdf.dll assembly.
Save SampleUdf.dll in "C:\UDFs".
Trusting a Location
To trust a location
On the Start menu, click All Programs.
Point to Microsoft SharePoint 2010 Products and click SharePoint Central Administration.
Under Application Management click Manage service applications.
On the Manage Service Applications page, click Excel Services Application.
On the Excel Services Application page, click Trusted File Locations.
On the Trusted File Locations page, click Add Trusted File Location.
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.
Under Location type, click the appropriate location type. In this example, select Microsoft SharePoint Foundation.
Under Trust Children, select Children trusted to trust child libraries or directories.
Under Allow User-Defined Functions, select User-defined functions allowed to allow UDFs to be called from workbooks stored in this trusted location.
To do the following steps, you need a computer that has SharePoint Server 2010 installed.
To enable UDFs
Follow steps 1 through 3 in the previous procedure ("To trust a location") to display the Shared Services home page for an SSP.
Under Excel Services Settings, click User-defined function assemblies.
On the Excel Services User-Defined Functions page, click Add User-Defined Function to open the ExcelServices Add User-Defined Function Assembly page.
In the Assembly box, type the path to the SampleUdf.dll assembly. In this example, it would be C:\UDFs\SampleUdf.dll.
Under Assembly Location, click File path.
Under Enable Assembly, the Assembly enabled check box should be selected by default.
If the AllowUdfs value is false when a session is started on a workbook that has UDF calls, the UDF calls will fail.
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.