Freigeben über


Bereitstellen von UDFs mit SharePoint Foundation-Lösungen

This example shows how to deploy a user-defined function (UDF) DLL by using the Microsoft SharePoint Foundation solution framework.

The SharePoint Foundation solution framework lets you bundle all the components to extend SharePoint Foundation in a new file called a solution file (a CAB-based format with a .wsp extension). A solution is a deployable, reusable package that can contain a set of features, site definitions, and assemblies that you can apply to a site, and individually enable or disable. Darüber hinaus können Sie die Lösungsdatei verwenden, um den Inhalt eines Webpartpakets bereitzustellen, einschließlich Assemblys, Klassenressourcen, DWP-Dateien und anderen Paketkomponenten. Weitere Informationen zum SharePoint Foundation-Lösungsframework finden Sie im SharePoint Foundation-Knoten im Erste Schritte mit Entwicklung für SharePoint Foundation 2010 (https://msdn.microsoft.com/library/ee539432(office.14).aspx).

The procedure for creating and deploying a UDF assembly by using SharePoint Foundation solution framework is as follows:

  1. Create the solution manifest file, Manifest.xml.

    The solution manifest (always called Manifest.xml) is stored at the root of a solution file. Diese Datei definiert die Liste der Features, Websitedefinitionen, Ressourcendateien, Webpartdateien und Assemblys, die verarbeitet werden sollen. It does not define the file structure; if files are included in a solution but not listed in the manifest XML file, they are not processed in any way.

    Hinweis

    Weitere Informationen zur Struktur der XML-Manifestdatei finden Sie in der Dokumentation zu SharePoint Foundation.

  2. Packen Sie die UDF-Assembly und die Datei „Manifest.xml“ in einer CAB-Datei.

  3. Make sure that the SharePoint Foundation Administration service is running on the server.

  4. Add the solution to the server by using stsadm.exe.

  5. Deploy the solution by using stsadm.exe.

Each Excel Services trusted location has an AllowUdfs flag.

Hinweis

Das AllowUdfs-Flag wird durch die Option Benutzerdefinierte Funktionen sind zugelassen auf der Seite „Vertrauenswürdige Dateispeicherorte von Excel Services“ bezeichnet. Informationen zum Navigieren zur Seite „Vertrauenswürdige Dateispeicherorte“ finden Sie in Schritt 3: Bereitstellen und Aktivieren von UDFs.

In order to allow UDFs to be called from a specific trusted location, you must:

  • Set the AllowUdfs value to true. The default value is false.
  • Add the UDF assembly to the trusted UDF list to allow the UDF to be called from a workbook.

Weitere Informationen zum Aktivieren von UDFs und zum Hinzufügen von UDFs zur Liste der vertrauenswürdigen UDF finden Sie unter Vorgehensweise: Aktivieren von UDFs.

Hinweis

Namenskonflikte vermeiden Sie, indem Sie den UDF-Assemblys und ihren Abhängigkeiten starke Namen geben und Namen wählen, die absolut eindeutig sind. Weitere Informationen finden Sie unter Excel Services Best Practices und Excel Services Known Issues and Tips.

Verfahren

So erstellen Sie die Datei "Manifest.xml"

  1. Right-click your project in Solution Explorer, point to Add, and then click New Item.
  2. Select XML File, and name the file Manifest.xml.
  3. Click Add.
  4. Fügen Sie der Datei den folgenden Inhalt hinzu:
<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="{57568687-2CC0-45bf-B66A-2D50D57108CA}" DeploymentServerType="ApplicationServer">
  <Assemblies>
    <Assembly DeploymentTarget="GlobalAssemblyCache" Location="EcsUdfsCommonSet.dll"/>
  </Assemblies>
</Solution>

Hinweis

Sie sollten für jede Lösung eine eindeutige GUID generieren. Weitere Informationen zum Projektmappenelement finden Sie unter SharePoint Foundation-Projektmappen und -Webpartpakete (https://msdn.microsoft.com/library/ms413687.aspx).

So erstellen Sie ein Lösungspaket

  • Informationen zum Erstellen einer Lösungsdatei finden Sie im Thema "Erstellen einer Lösung" unter dem Knoten "Lösungen und Webpartpakete" im SharePoint Foundation-SDK.

To verify whether SharePoint Foundation Administration is running

  1. Click Start, point to Administrative Tools, and then double-click Services.

    The Services dialog box appears.

  2. Make sure that the status of SharePoint Foundation Administration service shows Started. If it does not, right-click SharePoint Foundation Administration, and then select Start.

To add the solution

  1. Click Start, click Run, and then typecmd.

    The command prompt console appears.

  2. Run the following script to add the solution to SharePoint server:

    stsadm.exe -o addsolution -filename <pathtoCAB>
    

Hinweis

Die Stsadm.exe finden Sie unter: > C:\Programme\Common Files\Microsoft Shared\web server extensions\12\BIN.

Hinweis

Weitere Informationen zu Stsadm.exe Befehlsoptionen finden Sie unter Stsadm to Windows PowerShell Mapping (SharePoint Foundation 2010) (https://technet.microsoft.com/library/ff621081.aspx).

So stellen Sie die Lösung bereit

  1. Click Start, click Run, and then typecmd.

    The command prompt console appears.

  2. Run the following script to deploy the solution to SharePoint server.

    stsadm.exe -o deploysolution -name <filename of the CAB> -immediate -allowGacDeployment
    

    You should now see your UDF DLL in the global assembly cache.

Siehe auch

Aufgaben

Konzepte