Top Banner
SharePoint 2010 Developer Quick Start
23

SharePoint 2010 Development

Dec 05, 2014

Download

Technology

Presentation for MOSSIG Feb 2010 on SharePoint 2010 development.
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: SharePoint 2010 Development

SharePoint 2010 Developer Quick Start

Page 2: SharePoint 2010 Development

SharePoint Designer Improvements

• Add lists, columns, forms , custom actions without the need to go to the browser.

• Fine grained designer control

• SPD work migrates to Visual Studio 2010– SPD customization work exported to .wsp files– .wsp files imported into Visual Studio

Page 3: SharePoint 2010 Development

Development lifecycle

Prototype in Designer

Export to WSP

Import to Visual Studio 2010Refine features

Deploy

Page 4: SharePoint 2010 Development

Demo – Designer

Page 5: SharePoint 2010 Development

PowerShell

• 2007 administration = STSADM.EXE + extensions and console applications

• Replaced with PowerShell– PowerShell support effectively replaces STSADM.EXE– SharePoint admins/devs must learn PowerShell basics– You can write powerful scripts against WSS OM– You can develop custom PowerShell snap-ins

Page 6: SharePoint 2010 Development

PowerShell Tools

Page 7: SharePoint 2010 Development

PowerShell 101

• Get-Command -pssnapin Microsoft.SharePoint.PowerShell

• Get-Help Get-SPSite

• Get-Help Get-SPSite –Examples

• Get-Command -noun "SPService*" | Sort Noun | Select Noun –Unique

• Get-Command -noun "SPService*" | Sort Noun | Select Noun –Unique > text.txt

Page 8: SharePoint 2010 Development

SharePoint 2010 Developer Dashboard

Page 9: SharePoint 2010 Development

Correlation ID

Page 10: SharePoint 2010 Development

Visual Studio 2010 SharePoint Tools• End-to-end SharePoint 2010 developer story

– SharePoint Explorer for site exploration– SharePoint 2010 project and item templates– Visual designers for core scenarios– Migration path for Visual Studio 2008 for WSS 3.0– Extensible by 3rd party developers

• Benefits to SharePoint developers– Abstracts away details of RootFiles directory– Abstracts away details of building .wsp file– Lessens/eliminates need for external utilities

Page 11: SharePoint 2010 Development

Demo – VS 2010

Page 12: SharePoint 2010 Development

Feature Improvements

• Feature Versioning & Upgrade (ALM)• New Events• Workflow Association• Property Bag• UI Version• Web Templates• New custom action options

Page 13: SharePoint 2010 Development

Feature Versioning & Upgrade• Version Range – BeginVersion/EndVersion• Upgrade Elements

– CustomUpgradeAction• Parameters

– ApplyElementManifest– MapFile – FromPath/ToPath– AddContentTypeField

Page 14: SharePoint 2010 Development

Upgrade Scenario

Site A Feature X 1.0

Deployed

Site B Feature X Not

Deployed

Site A Feature X 1.0

Upgraded

Site B Feature X

Not Deployed

Site A Feature X 1.0

Upgraded

Site B Feature X 1.0 Deployed

+ Upgraded

Page 15: SharePoint 2010 Development

EventsAdded…• Item Events

– ContextEvent– ItemAdding/ItemAdded– ItemUpdating/ItemUpdated– ItemDeleting/ItemDeleted– ItemCheckingIn/ItemCheckedIn– ItemCheckingOut/ItemCheckedOut– ItemUncheckingOut/ItemUncheckedOut– ItemAttachmentAdding/ItemAttachmentAdded– ItemAttachmentDeleting/ItemAttachmentDeleted– ItemFileMoving/ItemFileMoved– ItemFileConverted

• Workflow Events– WorkflowStarting/WorkflowStarted– WorkflowPostponed– WorkflowCompleted

Site EventsSiteDeleting/SiteDeletedWebDeleting/WebDeletedWebMoving/WebMovedWebAdding/WebProvisioned

List EventsEmailReceivedFieldAdding/FieldAddedFieldUpdating/FieldUpdatedFieldDeleting/FieldDeletedListAdding/ListAddedListDeleting/ListDeleted

Page 16: SharePoint 2010 Development

Post Synchronous Events

• WSS 3.0 “after” events are exclusively asynchronous

• Problem when wanting to do post processing after item submitted, but before displaying to user

• SPF 4.0 adds new property on receiver definition to change “after” event to synchronous– SPEventReceiverDefinition.Synchronization

Page 17: SharePoint 2010 Development

Event Impersonation Improvements• WSS 3.0 events run in context of user who

triggered the event• Certain things trigger events to run under

System Account (workflow, etc), but doesn’t permit reverting back to user who triggered action

• SPF 4.0 now adds the originating user & user token on SPEventPropertiesBase

Page 18: SharePoint 2010 Development

Feature Property Bag• Promote Feature Properties into Web/Site

property bag– Root web– Web– Folder– List Item

• No direct VS designer support• Updates value if exists, otherwise adds

– Types enforced: DateTime, Int32

Page 19: SharePoint 2010 Development

Web Templates

• Replacement and Improved Framework for STP -- Save as Template->WSP

• Exports everything +content(optional) +onet.xml• Stored in Solution Gallery or at the Farm• $ListId:Lists/someListName• Considerations

– Use VS WSP import to trim or ‘featurize’ items– Web Templates are Features and can be upgraded

Page 20: SharePoint 2010 Development

Relational Lists: Joins

• With relational lists, SPF 4.0 adds support for joins

• Joins can only be implemented by developers using the API, CAML or SharePoint Designer 2010

• New properties on SPQuery:– SPQuery.Join– SPQuery.ProjectedFields

• Use SPLinq instead of CAML to join two lists in code

Page 21: SharePoint 2010 Development

Querying Large Lists

• If throttling is enabled & list limit exceeded threshold, users won’t be able to query lists by default via API

• Can override querying the large list settings provided Web App configured to allow it

• Override using:– SPQuery.RequestThrottleOverride– SPSiteDataQuery.RequestThrottleOverride

• Only users with proper permissions get override ability (set via policies)

Page 22: SharePoint 2010 Development

Content Iterator

SPQuery query = new SPQuery(); query.Query = "<Where><Eq><FieldRef Name=\"MyIndexedField\"/><Value Type=\"Text\">FieldValue</Value></Eq></Where>" + ContentIterator.ItemEnumerationOrderByNVPField;

ContentIterator ci = new ContentIterator();

ci.MaxItemsPerQuery = 500;

ci.ProcessItemsInList(query,

delegate(SPListItem item)

{ // Work on each item. },

delegate(SPListItem item, Exception e)

{ // Handle an exception that was thrown while iterating. // Return true so that ContentIterator rethrows the exception. return true; } );

Page 23: SharePoint 2010 Development

Questions ?

@laneyvbhttp://laneyvb.blogspot.com