Deploy a workflow as a WSP file (SharePoint Foundation 2010)
Aplica-se a: SharePoint Foundation 2010
Tópico modificado em: 2016-11-30
When you create a workflow and save it as a workflow template (.wsp file), you can use the template to deploy the workflow on multiple sites and site collections.
Running time: 3:34 |
Watch the "Deploy a workflow as a WSP file" video For an optimal viewing experience, download the "Deploy a workflow as a WSP file" video. Right-click the link, and then click Save Target As to download a copy. Clicking the link will open a .wmv file in the default video viewer for full-resolution viewing. |
To deploy a workflow as a .wsp file you do the following:
Download the WSP file
Upload the WSP file to a site collection
Activate the workflow feature on a site
Download the WSP file
Use the following procedure to open the Site Assets document library on the top-level site of the site collection that the workflow template was saved to and then download the workflow template as a .wsp file to a local folder on the server that is running Microsoft SharePoint Foundation 2010 or a network share. The downloaded file can then be uploaded to the Solutions Gallery of any site collection.
To download the WSP file to a file location
On the top-level site, in the Quick Launch, click All Site Content.
On the All Site Content page, in the Document Libraries section, click Site Assets.
Point to the name of the workflow that you want to edit and click the arrow that appears.
Point to Send To, and then click Download a Copy.
In the File Download dialog box, click Save.
In the Save As box, type the location to save the file, and then click Save.
In the Download Complete dialog box, click Close.
Upload the WSP file to a site collection
Use one of the following procedures to upload the .wsp file to the Solution Gallery of a site collection. This will make the workflow template available as a feature which you will then activate on the site collection. This makes the workflow available as a feature on all sites in the site collection. However, this does not activate the feature on any sites in the site collection.
In this section:
To upload the WSP file to a site collection by using the user interface
To upload the WSP file to a site collection by using Windows PowerShell
To upload the WSP file to a site collection by using the user interface
On the top-level site of the site collection, on the Site Actions menu, click Site Settings.
On the Site Settings page, in the Galleries section, click Solutions.
On the Solutions tab of the ribbon, in the New group, click Upload Solution.
In the Solution Gallery - Upload Solution dialog box, click Browse.
In the Choose File to Upload dialog box, select the file share, select the WSP file, and then click Open.
In the Solution Gallery - Upload Solution dialog box, click OK.
The Solution Gallery – Activate Solution dialog box appears.
In the Solution Gallery – Activate Solution dialog box, click Activate.
This makes the workflow available as a feature to all sites in this site collection. The name of the workflow now appears in the Solutions Gallery with Status set to Activated.
To upload the WSP file to a site collection by using Windows PowerShell
Verify that you meet the following minimum requirements: Consulte Add-SPShellAdmin. You also need to be a member of the SharePoint_Shell_Access role on the content database. For more information, see Add-SPShellAdmin and Get-SPContentDatabase.
On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows PowerShell command prompt, type the following command:
Add-SPUserSolution -LiteralPath <LiteralPath> -Site <SiteURL>
Where:
<LiteralPath> is the full path that includes the name, of the WSP file.
<SiteURL> is the URL of the site collection.
The workflow is now deployed as a feature. However, before you can use the workflow, you must activate it for the site collection.
At the Windows PowerShell command prompt, type the following command:
Install-SPUserSolution -Identity <Solution> -Site <SiteURL>
Where:
<Solution> is the name of the solution to activate.
<SiteURL> is the URL of the site collection.
For more information about the Add-SPUserSolution and Install-SPUserSolution cmdlets, see Install-SPUserSolution and Add-SPUserSolution.
Observação
Recomendamos que você use o Windows PowerShell ao executar tarefas administrativas de linha de comando. A ferramenta de linha de comando Stsadm está obsoleta, mas está incluída para oferecer suporte à compatibilidade com versões anteriores do produto.
Activate the workflow feature on a site
Use one of the following procedures to activate the feature on any sites where you want to use the workflow.
In this section:
To activate the workflow feature on a site by using the user interface
To activate the feature on a site by using Windows PowerShell
To activate the workflow feature on a site by using the user interface
Go to the site where you want to activate the feature and on the Site Actions menu, click Site Settings.
On the Site Settings page, in the Site Actions section, click Manage site features.
On the Features page for the site, you can see that the workflow template is available but not active.
Click Activate.
On the Features page, the workflow template Status now appears as Active.
To activate the feature on a site by using Windows PowerShell
Verify that you meet the following minimum requirements: Consulte Add-SPShellAdmin. You also need to be a member of the SharePoint_Shell_Access role on the content database. For more information, see Add-SPShellAdmin and Get-SPContentDatabase.
On the Start menu, click All Programs.
Click Microsoft SharePoint 2010 Products.
Click SharePoint 2010 Management Shell.
At the Windows PowerShell command prompt, type the following command:
Enable-SPFeature -Identity <Feature> -Url <URL>
Where:
<Feature> is the name of the feature to activate.
Observação
The feature name is not the same name that you gave the workflow. Instead, the feature name is typically the workflow name with "ListInstances" appended to it.
If you are not sure of the name of the feature that you want to activate, you can do the following to verify the feature name.-
Make a copy of the .wsp file and change the file name extension on the copied file to .cab.
-
In Windows Explorer, right-click the .cab file, and then click Open.
-
Select feature.xml.
The feature name is listed in the Path column.
-
<URL> is the URL of the site.
For more information about the Enable-SPFeature cmdlet, see Enable-SPFeature.
Observação
Recomendamos que você use o Windows PowerShell ao executar tarefas administrativas de linha de comando. A ferramenta de linha de comando Stsadm está obsoleta, mas está incluída para oferecer suporte à compatibilidade com versões anteriores do produto.