Search This Blog

Monday, August 30, 2010

Deploy and Retract a Custom Web Part in SharePoint 2007

Here is a Blog to show you the quick and easy way to deploy and retract a Custom Web Part as a Solution Package and Feature in SharePoint 2007:

Deploy Web Part Solution

1. Create a folder called “DeploySPSolutions” in the 12\Bin (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN).

2. Copy your solution package file, MyWebPart.wsp into the DeploySolutions folder

3. To add and deploy the solution from the 12\bin run the following stsadm.exe commands and check for the following messages:

a. Stsadm.exe –o addsolution –filename DeploySPSolutions\MyWebPart.wsp

b. Ensure stsadm.exe returns the “Operation completed successfully.” message

c. Stsadm.exe –o deploysolution –name MyWebPart.wsp –url http://moss.example.com [use the actual deployment site url] –local -allowGacDeployment

d. Ensure stsadm.exe returns the “Operation completed successfully.” message

4. Navigate to the deployment site’s home page

5. To activate the feature from the deployment site’s home page navigate to the Site Collection Features page:

a. Site Actions -> Site Settings->Site Collection Administration->Site Collection Features

b. Click the “Activate” button next to the MyWebPart feature

6. To verify the web part install from the deployment site’s home page navigate to the Web Part Galleries page:

a. Site Actions -> Site Settings -> Galleries -> Web Part Galleries

b. Verify that the MyWebPart.wsp Web Part is installed

7. To add the web part to the home page from the deployment site’s home page add the web part:

a. Site Settings-> Edit Page

b. Click on “Add a Web Part”

c. In miscellaneous Web Parts choose “My Web Part” and click “Add”

d. Click on “Exit Edit Mode”

8. Check the latest system event log for errors

9. Check the latest SharePoint logs for errors


Retract Web Part Solution

1. To remove the web part from the deployment site’s home page:

a. Site Settings-> Edit Page

b. Click o the “Custom Date Search” web part’s edit button and click “Delete”

c. Click on “Exit Edit Mode”

2. To deactivate the feature from the deployment site’s home page navigate to the Site Collection Features page:

a. Site Actions -> Site Settings->Site Collection Administration->Site Collection Features

b. Click the “Deactivate” button next to the MyWebPart

c. At the warning page choose “Deactivate this feature”

d. At the Site Collections Feature page the web part should now have an “Activate” button next to it and the status should be blank

3. To delete the web part from the deployment site’s Web Part Galleries navigate to the Web Part Galleries page to delete the web part:

a. Site Actions -> Site Settings -> Galleries -> Web Part Galleries

b. Verify that the MyWebPart.wsp Web Part is deleted

c. If the MyWebPart.wsp Web Part is not deleted then click on the edit button next to the web part name

d. From the edit interface choose “Delete Item”

e. Verify that the MyWebPart.wsp Web Part is deleted

4. To retract and delete the solution From the 12\bin run the following stsadm.exe commands and check for the following messages:

a. Stsadm.exe –o retractsolution –name MyWebPart.wsp –url http://moss.example.com [use the actual deployment site url] –immediate

b. Ensure stsadm.exe returns the “Operation completed successfully” message

c. Execute the administrative service job – stsadm.exe -o execadmsvcjobs

d. Stsadm.exe –o deletesolution –name MyWebPart.wsp

e. Ensure stsadm.exe returns the “Operation completed successfully” message

f. Execute the administrative service job – stsadm.exe -o execadmsvcjobs

5. Check the latest system event log for errors

6. Check the latest SharePoint logs for errors


And that's all there is too it!

No comments: