Top Banner
Web parts for SharePoint
17

Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Dec 26, 2015

Download

Documents

Arthur Tucker
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Web parts for SharePoint

Page 2: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

What’s a web part?Application that can be added to a page

with a web part zone.Inhierits from web controlsCan be developed using C# or VBThe concept of web parts are not just for

SharePoint

Page 3: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Web part lifecycle

Without postback With postback

OnInitOnLoadCreateChildControl

sOnPreRenderRender

OnInitCreateChildContr

olsOnLoadOnPreRenderRender

Page 4: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

OnInitUsed to initialize controls.

Page 5: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

OnLoadSet the basic layout of the web part like

TitleChrometypeWidth/height

These can also be found in the properties of the web part and be set individually after the web part has been deployed.

Page 6: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

CreateChildControlsCreate child controls and layout here

Page 7: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

OnPreRenderUsed for tasks that needs to be executed

before the web part is rendered.Load data

Page 8: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

RenderRenders the whole web partOnly overwritten i rare situations i case of

special rendering requirements

Page 9: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

<name>.webpartDescription for the web part shown in the

Web part Gallery

Page 10: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

<name>.xmlAdds the web part to a group in the Web

part GalleryIf a group is not specified, the web part is

placed in the group Miscelleaneous

Page 11: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Feature.xmlLocation of the <name>.xmlLocation of the <name>.webpart

Page 12: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Manifest.xmlTells where the feature.xml file is locatedLocation of the assembly

Page 13: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Create your own propertiesEnables you to add string/integer (textboxes),

bool (checkboxes), collection (dropdownlists) to your properties.

The web part already contains properties, so all you have to do is add your own.

Page 14: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Extend your propertiesToolpartsEnables you to add listboxes, peoplepicker,

buttons etc. to the properties.Has it’s own lifecycle similar to a web part.

Page 15: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Time to deployTwo ways to deploy your wsp file:

1. Using install.bat (created by VS for you to use) REMEMBER to change the URL in the install.bat if you

want to install it on a server with a different name.

2. Using stsadm stsadm -o addsolution -filename <Solution

filename> stsadm -o activatefeature {-filename <relative

path to Feature.xml> | -name <feature folder> | -id <feature Id>} [-url <url>] [-force]

A complete list of stsadm operations can be found here: http://blogs.technet.com/josebda/archive/2008/03/15/complete-reference-of-all-stsadm-operations-with-parameters-in-moss-2007-sp1.aspx

Page 16: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

My favorite sites for SharePoint:http://www.codeproject.comhttp://tonybierman.blogspot.com/http://www.sharepoint-tips.com/http://stsadm.blogspot.com/Google Groups

Page 17: Web parts for SharePoint. What’s a web part? Application that can be added to a page with a web part zone. Inhierits from web controls Can be developed.

Debate - Why use web parts?

Pros ConsIntegated part of

SharePointThe developer is

provided with libraries to make the development of web parts easier

Consistens in design throughtout the web parts

Might work in test environment but not in production

Requires custom development

Requires knowledge of the internal structure in SharePoint