What’s new in events? What’s new in lists and how can I utilize these new functionalities?

Post on 18-Jan-2016

222 views 0 download

Tags:

Transcript of What’s new in events? What’s new in lists and how can I utilize these new functionalities?

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Advanced Developer Training

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List Enhancements and Customizations in SharePoint 2010

NameTitleCompany

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Agenda

Improved Support for EventsList Relationships and JoinsField & List Item validation and improvementsLarge List SupportXSL Based ViewsInfoPath for list forms and web part usage

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

IMPROVED SUPPORT FOR EVENTS

What’s new in events?

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

New & Improved Events

New events in SPF 2010WebAdding & WebProvisionedListAdding & ListAddedListDeleting & ListDeleted

New Registration CapabilitiesSite collection level event registration to support new eventsSPSite & SPWeb event receiver registration via Features

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Post Synchronous Events

WSS 3.0 “after” events are exclusively asynchronousProblem when wanting to do post processing after item submitted, but before displaying to userSPF 2010 adds new property on receiver definition to change “after” event to synchronous

SPEventReceiverDefinition.Synchronization

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Cancelling Events & Custom Error Pages

WSS 3.0 provided capability to cancel synchronous events & returning an error messageSPF 2010 introduces capability to cancel error and redirect user to custom error page

Not possible on post synchronous eventsSynchronous cancel with redirection URLOffice clients support cancellation, but not redirection

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Event Impersonation Improvements

WSS 3.0 events run in context of user who triggered the eventCertain things trigger events to run under System Account (workflow, etc), but doesn’t permit reverting back to user who triggered actionSPF 2010 now adds the originating user & user token on SPEventPropertiesBase

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Events in Visual Studio 2010 Tools

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

New & Improved Events

demo

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

LIST RELATIONSHIPS AND JOINS

What’s new in lists and how can I utilize these new functionalities?

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Relational Lists & Joins

SPF 2010 introduces the capability to have a relationship behavior enforced by a Lookup fieldNew investments:

Projected fields into child listsJoinsRelational integrity between parent & child lists

Introduces also new security considerations and possible issues

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List lookups

Lookups form relationships between lists

One-to-manyMany-to-many

1 m mProjects TimecardsClients

Lookup

1

Lookup

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List relationships and data integrity

One-to-many relationships can be used to:

Trigger Cascade DeleteRestrict Delete

1 m m

Lookup

1

Lookup

ProjectsClients Timecards

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List joins and projections

Query within and across lists:Join lists using lookup columnsLookup to multiple columns

1 m m

Lookup

1

Lookup

QueryResult Set

ProjectsClients Timecards

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Projected Fields and joins

Projected FieldsExtra field pulled from parent list into view of child listVia browser interface, users add a lookup User can select a secondary fields to pull into the child list

JoinsJoins can only be implemented by developers using the API, CAML or SharePoint Designer 2010New properties on SPQuery:

SPQuery.Join & SPQuery.ProjectedFields

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

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Relational Lists: Projected Fields

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Relational Lists & Joins

demo

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

LARGE LIST SUPPORT

What’s new for large lists and how to access them efficiently?

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Large List Support

SPF 2010 lists can now support 50M items

Under read scenariosPlatform Investments:

Configuration options for administrators per Web application (Central Administration)Site collection & list administrators can request exemptions from the throttle (for expensive queries)

Throttling in place by default

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Managing Large Lists

Web Application Settings:List view threshold (w/ warning threshold)Allow object model override

Enables developers with sufficient permissions to programmatically use the List View Threshold for administrators and auditors, which is higher than the normal user's List View Threshold by default:

List View Threshold: 5,000 items List View Threshold for Administrators and Auditors: 20,000 items

Daily window time for expensive queries without threshold

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Managing Large Lists (2)

List level settingsKicks in when the item amount in list meets certain thresholdList administrators can see warnings & messages when lists exceed thresholds from list settings pageNote. Warnings are based on item count on the list, not on the item amount on single view

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Content Iteration – handling items in batches

Scenarios:Moving all items tagged with “Confidential” to another repositoryReporting on all content in a site about to go live in the next monthProcessing all content in a library that is expiring within the next monthEnforcing metadata consistency or change across a corpus of content

Solution: ContentIterator

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Threshold

List20,000

All items:

SPQuery:

Expiration >= 07/01/200914,000

Sorted by index:Expiration < 07/01/2009

6,000

5,000 Threshold!

query.Query =     “<where><Lt><FieldRef Name=‘Expiration’/>” +    “<Value type=‘DateTime’>2009-07-01</Value></Lt></where>” query.ViewAttributes = “Scope=‘Recursive’”;

SPListItemCollection items = list.GetItems(query);

Foreach (SpListItem item in items) {    // Add to report}

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Using ContentIterator

List20,000

All items:

SPQuery:

Expiration >= 07/01/200914,000

Sorted by index:Expiration < 07/01/2009

6,000

2k

query.Query =     “<where><Lt><FieldRef Name=‘Expiration’/>” +    “<Value type=‘DateTime’>2009-07-01</Value></Lt></where>”

ContentIterator ci = new ContentIterator();ci.ProcessListItems(    list,    query,    true,  // Recursive query    2000,  // Page size of 2000    delegate(SPListItemCollection items) {        // Process the items batch by batch    },    delegate(SPListItemCollection items, Exception e) {        // Handle exception    });

2k

2k

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Wide List Limits & Threshold

Support for number of fields that makeup a SPListItem

SPF 2010 – SPListItems are limited to 6 rows

SPListItem limited to 8KB of data

List view lookup threshold = eightException thrown if code tries to select fields from more than eight fields from the joined listsIf no view fields specified (maximal view), only the first eight pulled and only the IDs for the remaining lookups will be retrieved.

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Using content iterator to handling list items

demo

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

FIELD & LIST ITEM VALIDATION AND IMPROVEMENTS

How to define field or list item validations?

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Unique Column Constraints

Lists can now contain columns that require all values in all items in the list for that column to be unique

Scoped at SPList, not SPFolder, level

Unique columns must be indexed (automatically configured)When making existing column unique, existing data is validatedUniqueness determined by SQL collation

Ex: Case sensitive / insensitive

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List Item Validation

Items are validated against a custom formula when saved

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List Item Field Validation

Similar to list item validation, each column can be validated using a custom field, or by referencing other fields

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published April 2010

Defining validations from codeYou can define the validation rules for list item or item field also from code – like from feature receiver

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

List item and field validations

demo

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

XSL BASED VIEWSHow the rendering logic of lists have been improved?

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

WebPart

BaseXsltDataWebPartData

ViewWebPart (V2)

DataFormWebPart (V3)

BaseXsltList

WebPart

(v4)

XsltListFormWebPart (V4)

XsltListViewWebPart (V4)

ListFormWebPart

ListViewWebPart

XsltListViewWebPart

Replaces ListViewWebPartRich customization support through SPDSchema agnosticBetter UX In-Place Editing

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Inside the XsltListViewWebPartXmlDefinition

ListName

XSL

SPDataSource

HTML

XsltListViewWebPart

XslCompiled

Transform

CAML Query

List Schema

View Transform

XML Data

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

XsltListViewWebPart

demo

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

INFOPATH FOR LIST FORMS AND WEB PART USAGE

Flexible form design for lists and forms in web parts

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

InfoPath 2010 and SharePoint 2010

Improved Field Picker

List Data Connection

Library Data

ConnectionList Forms

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

SharePoint List Solutions

List item forms can be changed to InfoPath formsAccess point from list or from SharePoint designer

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Creating an InfoPath List Form

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Example usage of InfoPath form in web part

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

InfoPath forms in lists and in sites

demo

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

Summary

Improved Support for EventsList Relationships and JoinsLarge List SupportField & List Item validation and improvementsXSL Based ViewsInfoPath for list forms and web part usage

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

©2010 Microsoft Corporation. All rights reserved. RTM Content - Published May 2010

© 2010 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after

the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.