Applications collaboratives avec Windows SharePoint Services.
Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio...
-
Upload
marvin-martin -
Category
Documents
-
view
214 -
download
1
Transcript of Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio...
![Page 1: Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 Windows SharePoint Services.](https://reader035.fdocuments.us/reader035/viewer/2022071807/56649eac5503460f94bb2407/html5/thumbnails/1.jpg)
CUSTOM WEB PART BASICS
Eric Maurer
Copyright Keller Schroder 2008
VISUAL STUDIO ADD-INS Windows SharePoint Services 30 Tools
Visual Studio 2005 Extensions Version 11 Windows SharePoint Services 30 Tools
Visual Studio 2008 Extensions Version 12 Includes Projects For
Web Parts List Definition Site Definitions
Caveats Must run on a SharePoint server No visual designer Be careful when renaming web parts
IMPORTANT WEB PART METHODS Default constructor
Initialize variables and hook up event handlers here
Override Create Child ControlsAdd all controls to the web partrsquos controls
Override Render ContentsThis method can be overridden to write
content directly to the output
COMMON OBJECT MODEL CLASSES SPContext ndash Current context of the HTTP
request SPSite ndash Site Collection
SPContextCurrentSitenew SPSite(url)
SPWeb ndash SiteSpcontextCurrentWebsiteAllWebs[ldquonamerdquo]
SPUser ndash UserWebCurrentUser
WHEN DO I NEED TO USE DISPOSE Do not dispose if using SPContext
This is used internally by SharePoint and it will handle disposing of them when the page is closed
Use dispose if you are using the ldquonewrdquo methods SPSite site = new Site(http) you must dispose
of the SPSite and SPWeb if used to prevent memory leaks by using a using statement or a try catch finally block
Also sites or webs created in foreach statements must be disposedforeach(SPWeb web in siteAllWebs)
do something here
webDispose()
DEPLOYMENT Use the Visual Studio Tools to create a
Solution file Use a custom batch file to deploy the
web part a feature
stsadmexe -o addsolution -filename webpartpathwsp
stsadmexe -o deploysolution -immediate -allowGacDeployment -name webpartnamewsp -url httphellip -force
stsadmexe -o execadmsvcjobs
stsadmexe -o installfeature -filename webpartnamefeaturexml
stsadmexe -o activatefeature ndashname webpartname -url http
iisreset
- Custom Web Part Basics
- Visual Studio Add-Ins
- Important web part methods
- COMMON OBJECT MODEL classes
- When Do I need to use dispose
- Deployment
-
![Page 2: Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 Windows SharePoint Services.](https://reader035.fdocuments.us/reader035/viewer/2022071807/56649eac5503460f94bb2407/html5/thumbnails/2.jpg)
VISUAL STUDIO ADD-INS Windows SharePoint Services 30 Tools
Visual Studio 2005 Extensions Version 11 Windows SharePoint Services 30 Tools
Visual Studio 2008 Extensions Version 12 Includes Projects For
Web Parts List Definition Site Definitions
Caveats Must run on a SharePoint server No visual designer Be careful when renaming web parts
IMPORTANT WEB PART METHODS Default constructor
Initialize variables and hook up event handlers here
Override Create Child ControlsAdd all controls to the web partrsquos controls
Override Render ContentsThis method can be overridden to write
content directly to the output
COMMON OBJECT MODEL CLASSES SPContext ndash Current context of the HTTP
request SPSite ndash Site Collection
SPContextCurrentSitenew SPSite(url)
SPWeb ndash SiteSpcontextCurrentWebsiteAllWebs[ldquonamerdquo]
SPUser ndash UserWebCurrentUser
WHEN DO I NEED TO USE DISPOSE Do not dispose if using SPContext
This is used internally by SharePoint and it will handle disposing of them when the page is closed
Use dispose if you are using the ldquonewrdquo methods SPSite site = new Site(http) you must dispose
of the SPSite and SPWeb if used to prevent memory leaks by using a using statement or a try catch finally block
Also sites or webs created in foreach statements must be disposedforeach(SPWeb web in siteAllWebs)
do something here
webDispose()
DEPLOYMENT Use the Visual Studio Tools to create a
Solution file Use a custom batch file to deploy the
web part a feature
stsadmexe -o addsolution -filename webpartpathwsp
stsadmexe -o deploysolution -immediate -allowGacDeployment -name webpartnamewsp -url httphellip -force
stsadmexe -o execadmsvcjobs
stsadmexe -o installfeature -filename webpartnamefeaturexml
stsadmexe -o activatefeature ndashname webpartname -url http
iisreset
- Custom Web Part Basics
- Visual Studio Add-Ins
- Important web part methods
- COMMON OBJECT MODEL classes
- When Do I need to use dispose
- Deployment
-
![Page 3: Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 Windows SharePoint Services.](https://reader035.fdocuments.us/reader035/viewer/2022071807/56649eac5503460f94bb2407/html5/thumbnails/3.jpg)
IMPORTANT WEB PART METHODS Default constructor
Initialize variables and hook up event handlers here
Override Create Child ControlsAdd all controls to the web partrsquos controls
Override Render ContentsThis method can be overridden to write
content directly to the output
COMMON OBJECT MODEL CLASSES SPContext ndash Current context of the HTTP
request SPSite ndash Site Collection
SPContextCurrentSitenew SPSite(url)
SPWeb ndash SiteSpcontextCurrentWebsiteAllWebs[ldquonamerdquo]
SPUser ndash UserWebCurrentUser
WHEN DO I NEED TO USE DISPOSE Do not dispose if using SPContext
This is used internally by SharePoint and it will handle disposing of them when the page is closed
Use dispose if you are using the ldquonewrdquo methods SPSite site = new Site(http) you must dispose
of the SPSite and SPWeb if used to prevent memory leaks by using a using statement or a try catch finally block
Also sites or webs created in foreach statements must be disposedforeach(SPWeb web in siteAllWebs)
do something here
webDispose()
DEPLOYMENT Use the Visual Studio Tools to create a
Solution file Use a custom batch file to deploy the
web part a feature
stsadmexe -o addsolution -filename webpartpathwsp
stsadmexe -o deploysolution -immediate -allowGacDeployment -name webpartnamewsp -url httphellip -force
stsadmexe -o execadmsvcjobs
stsadmexe -o installfeature -filename webpartnamefeaturexml
stsadmexe -o activatefeature ndashname webpartname -url http
iisreset
- Custom Web Part Basics
- Visual Studio Add-Ins
- Important web part methods
- COMMON OBJECT MODEL classes
- When Do I need to use dispose
- Deployment
-
![Page 4: Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 Windows SharePoint Services.](https://reader035.fdocuments.us/reader035/viewer/2022071807/56649eac5503460f94bb2407/html5/thumbnails/4.jpg)
COMMON OBJECT MODEL CLASSES SPContext ndash Current context of the HTTP
request SPSite ndash Site Collection
SPContextCurrentSitenew SPSite(url)
SPWeb ndash SiteSpcontextCurrentWebsiteAllWebs[ldquonamerdquo]
SPUser ndash UserWebCurrentUser
WHEN DO I NEED TO USE DISPOSE Do not dispose if using SPContext
This is used internally by SharePoint and it will handle disposing of them when the page is closed
Use dispose if you are using the ldquonewrdquo methods SPSite site = new Site(http) you must dispose
of the SPSite and SPWeb if used to prevent memory leaks by using a using statement or a try catch finally block
Also sites or webs created in foreach statements must be disposedforeach(SPWeb web in siteAllWebs)
do something here
webDispose()
DEPLOYMENT Use the Visual Studio Tools to create a
Solution file Use a custom batch file to deploy the
web part a feature
stsadmexe -o addsolution -filename webpartpathwsp
stsadmexe -o deploysolution -immediate -allowGacDeployment -name webpartnamewsp -url httphellip -force
stsadmexe -o execadmsvcjobs
stsadmexe -o installfeature -filename webpartnamefeaturexml
stsadmexe -o activatefeature ndashname webpartname -url http
iisreset
- Custom Web Part Basics
- Visual Studio Add-Ins
- Important web part methods
- COMMON OBJECT MODEL classes
- When Do I need to use dispose
- Deployment
-
![Page 5: Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 Windows SharePoint Services.](https://reader035.fdocuments.us/reader035/viewer/2022071807/56649eac5503460f94bb2407/html5/thumbnails/5.jpg)
WHEN DO I NEED TO USE DISPOSE Do not dispose if using SPContext
This is used internally by SharePoint and it will handle disposing of them when the page is closed
Use dispose if you are using the ldquonewrdquo methods SPSite site = new Site(http) you must dispose
of the SPSite and SPWeb if used to prevent memory leaks by using a using statement or a try catch finally block
Also sites or webs created in foreach statements must be disposedforeach(SPWeb web in siteAllWebs)
do something here
webDispose()
DEPLOYMENT Use the Visual Studio Tools to create a
Solution file Use a custom batch file to deploy the
web part a feature
stsadmexe -o addsolution -filename webpartpathwsp
stsadmexe -o deploysolution -immediate -allowGacDeployment -name webpartnamewsp -url httphellip -force
stsadmexe -o execadmsvcjobs
stsadmexe -o installfeature -filename webpartnamefeaturexml
stsadmexe -o activatefeature ndashname webpartname -url http
iisreset
- Custom Web Part Basics
- Visual Studio Add-Ins
- Important web part methods
- COMMON OBJECT MODEL classes
- When Do I need to use dispose
- Deployment
-
![Page 6: Eric Maurer Copyright Keller Schroder 2008. Windows SharePoint Services 3.0 Tools: Visual Studio 2005 Extensions, Version 1.1 Windows SharePoint Services.](https://reader035.fdocuments.us/reader035/viewer/2022071807/56649eac5503460f94bb2407/html5/thumbnails/6.jpg)
DEPLOYMENT Use the Visual Studio Tools to create a
Solution file Use a custom batch file to deploy the
web part a feature
stsadmexe -o addsolution -filename webpartpathwsp
stsadmexe -o deploysolution -immediate -allowGacDeployment -name webpartnamewsp -url httphellip -force
stsadmexe -o execadmsvcjobs
stsadmexe -o installfeature -filename webpartnamefeaturexml
stsadmexe -o activatefeature ndashname webpartname -url http
iisreset
- Custom Web Part Basics
- Visual Studio Add-Ins
- Important web part methods
- COMMON OBJECT MODEL classes
- When Do I need to use dispose
- Deployment
-