Showing posts with label SharePoint Solution Package Web Part. Show all posts
Showing posts with label SharePoint Solution Package Web Part. Show all posts

Friday, December 21, 2007

SharePoint: How to add a web part to a page from a solution package

Assume you already got a solution package (.wsp) of the web part.

First, you have to install it:

SET STSADM="%full path%\STSADM.EXE"
SET URL="http://urlOfMySite"
SET SPACK="myWebPart.wsp"

%STSADM% -o retractsolution -name %SPACK% -immediate -url %URL%
%STSADM% -o execadmsvcjobs

%STSADM% -o deletesolution -name %SPACK% -override
%STSADM% -o execadmsvcjobs

%STSADM% -o addsolution -filename %SPACK%
%STSADM% -o execadmsvcjobs

%STSADM% -o deploysolution -name %SPACK% -immediate -allowgacdeployment -url %URL%
%STSADM% -o execadmsvcjobs

Then, from the site where you want to add the web part to a page:

Site Actions | Site Settings | Modify All Site Settings | Galleries | Web Parts, New
Choose your web part, click "Populate Gallery"

Then,

Site Actions | Site Settings | Modify All Site Settings | Site Collection Administration | Site Collection Features, click "Activate" to activate your web part

Then, you should be able to add your web part to a page on that site:

Navigate to a page
Site Actions | Edit Page, Add a Web Part, choose your web part, Add, Publish