Microsoft ® Official Course Working with Lists and Libraries Microsoft SharePoint 2013 SharePoint Practice.

Slides:



Advertisements
Similar presentations
Site Collection, Sites and Sub-sites
Advertisements

Microsoft ® Official Course Client-Side SharePoint Development SharePoint Practice Microsoft SharePoint 2013.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Lesson 17: Configuring Security Policies
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Microsoft ® Official Course Interacting with the Search Service Microsoft SharePoint 2013 SharePoint Practice.
Microsoft SharePoint 2013 SharePoint 2013 as a Developer Platform
Microsoft ® Official Course Working with SharePoint Objects Microsoft SharePoint 2013 SharePoint Practice.
Managing Identity and Permissions
ASP.NET Programming with C# and SQL Server First Edition
Microsoft ® Official Course Developing Optimized Internet Sites Microsoft SharePoint 2013 SharePoint Practice.
Microsoft ® Official Course Introducing Apps for SharePoint SharePoint Practice Microsoft SharePoint 2013.
Microsoft ® Official Course Managing and Accessing User Profile Data Microsoft SharePoint 2013 SharePoint Practice.
Microsoft ® Official Course Developing Managed Metadata Solutions Microsoft SharePoint 2013 SharePoint Practice.
Module 9 Designing an XML Strategy. Module 9: Designing an XML Strategy Designing XML Storage Designing a Data Conversion Strategy Designing an XML Query.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Entity Framework, a quickstart Florin−Tudor Cristea, Microsoft Student Partner.
Module 14: Configuring Print Resources and Printing Pools.
Module 8 Configuring and Securing SharePoint Services and Service Applications.
Developing Workflows with SharePoint Designer David Coe Application Development Consultant Microsoft Corporation.
Objectives Overview Define the term, database, and explain how a database interacts with data and information Define the term, data integrity, and describe.
Module 14: WCF Send Adapters. Overview Lesson 1: Introduction to WCF Send Adapters Lesson 2: Consuming a Web Service Lesson 3: Consuming Services from.
Chapter 15: Using LINQ to Access Data in C# Programs.
Creating a Web Site to Gather Data and Conduct Research.
Module 7: Fundamentals of Administering Windows Server 2008.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Workflow Development Overview Architecture Requirements Types of workflows Stages of workflow.
Chapter 8 Cookies And Security JavaScript, Third Edition.
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Sites Lists Advanced Site collection administration –Moving sites –Save site as template.
The SharePoint Shepherd’s Course for End Users Based on the book by Robert L. Bogue Copyright 2011 AvailTek LLC All Rights Reserved.
Microsoft ® Official Course Module 3 Managing Active Directory Domain Services Objects.
HOW SHAREPOINT WORKS By Gary Newman. Root Folder Virtual Directories SP Farm DNS Iterative Forward DNS query for A host record HTTP request HTML & JS.
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Definitions Collaboration – working together on team projects and sharing information,
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
Module 10 Administering and Configuring SharePoint Search.
New & Improved Events List Relationships and Joins Large List Support Field & List Item Validation.
Module 14 Monitoring and Optimizing SharePoint Performance.
Module 6 Securing Content. Module Overview Administering SharePoint Groups Implementing SharePoint Roles and Role Assignments Securing and Auditing SharePoint.
IR Homework #2 By J. H. Wang Mar. 31, Programming Exercise #2: Query Processing and Searching Goal: to search relevant documents for a given query.
Office Business Applications Workshop Defining Business Process and Workflows.
Reports and Learning Resources Module 5 1. SLMS Primary Administrator Training Module 5: Reports and Learning Resources 2.
Module 3: Managing a Microsoft ® Windows ® Small Business Server Environment.
PS SharePoSH:\> SPListItem / SPFile SharePoint + PowerShell User Group March 27,
Module 7 Planning and Deploying Messaging Compliance.
Configuring Workflows Module 4. Overview  Understanding Workflows  Using Default Workflows  Creating Workflow Instances.
Copyright © 2006 Pilothouse Consulting Inc. All rights reserved. Search Overview Search Features: WSS and Office Search Architecture Content Sources and.
What’s New in SharePoint 2010 SharePoint 2010 Development Primer New Developer Tools for SharePoint 2010 SharePoint 2010 Integration with PowerShell.
CharMeck.org Contributer Training SharePoint 2013 Orientation and Basic Training.
Microsoft ® Official Course Developing a Publishing Site for Web Content Microsoft SharePoint 2013 SharePoint Practice.
Module 4 Taking Control of the User Interface. Module Overview Sharing Logical Resources in an Application Creating Consistent User Interfaces by Using.
Microsoft ® Official Course Designing and Managing Features and Solutions Microsoft SharePoint 2013 SharePoint Practice.
Microsoft ® Official Course Customizing the Search Experience Microsoft SharePoint 2013 SharePoint Practice.
Microsoft ® Official Course Implementing Enterprise Content Management Microsoft SharePoint 2013 SharePoint Practice.
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
Module 2: Using ADO.NET to Access Data. Overview ADO.NET Architecture Creating an Application That Uses ADO.NET to Access Data Changing Database Records.
Module 2: Authoring Basic Reports. Overview Creating a Basic Table Report Formatting Report Pages Calculating Values.
Programming the Microsoft SharePoint Products and Technologies Object Model Paul Appleby Developer & Platform Group
Microsoft ® Official Course Module 9 Working with Business Connectivity Services.
Add/Remove/Update a list column All columns including lookup and calculated columns, in addition to many types of updates, such as a type change or.
APAN SharePoint Permissions
Working with Server-Side Code
Programming SharePoint Object Model, Web Services, and Events
Microsoft Dynamics.
Site scripts and Site Design
Presentation transcript:

Microsoft ® Official Course Working with Lists and Libraries Microsoft SharePoint 2013 SharePoint Practice

Module Overview Using List and Library Objects Querying and Retrieving List Data Working with Large Lists

Lesson 1: Using List and Library Objects Understanding the List and Library Class Hierarchy Retrieving List and Library Objects Creating and Deleting List and Library Objects Working with List Items Demonstration: Creating List Items Working with Fields Working with Files

Understanding the List and Library Class Hierarchy SPList SPField SPListItem SPFile SPFolder SPDocumentLibrary Inherits from… One-to-one Contains collection of…

Retrieving List and Library Objects Retrieve lists and libraries from the parent SPWeb instance Cast to SPDocumentLibrary if required var web = SPContext.Current.Web; // Use an indexer. SPList documents = web.Lists["Documents"]; // Use a method. SPList images = web.GetList("Lists/Images"); if (documents is SPDocumentLibrary) { var docLibrary = (SPDocumentLibrary)documents; }

Creating and Deleting List and Library Objects Terminology: List definition List template List instance Creating list instances Deleting list instances var web = SPContext.Current.Web; Guid listID = web.Lists.Add("Title", "Description", SPListTemplateType.Contacts); var web = SPContext.Current.Web; SPList list = web.Lists["Title"]; list.Delete();

Working with List Items Adding items to a list SPList.Items.Add() Retrieving and modifying list items SPList.GetItemById(int ID) SPList.GetItemByUniqueId(Guid uniqueID) Deleting list items SPListItem.Delete() SPList.Items.Delete(int index) SPList.Items.DeleteItemById(int ID)

Demonstration: Creating List Items In this demonstration, you will see an example of how to create list items programmatically.

Demonstration: Creating List Items

Working with Fields Field classes and field value classes Simple field types accept simple values Complex field types have specific field value classes Setting complex field values Retrieving complex field values Double latitude = ; Double longitude = ; var geoValue = new SPFieldGeolocationValue(latitude, longitude); item["location"] = geoVal; var geoValue = item["location"] as SPFieldGeolocationValue; Double latitude = geoValue.Latitude; Double longitude = geoValue.Longitude;

Working with Files Retrieving files Get files from SPWeb object or SPFolder object Use an indexer (SPWeb.Files or SPFolder.Files) Use a method (SPWeb.GetFile, SPWeb.GetFileAsString) Checking files in and out Adding and updating files SPFileCollection.Add method if (file.CheckOutType == SPFile.SPCheckOutType.None) { file.CheckOut(); // Update the file as required…. file.CheckIn("File updated."); }

Lesson 2: Querying and Retrieving List Data Approaches to Querying List Data Discussion: Retrieving List Data in Code Building CAML Queries Using the SPQuery Class Using the SPSiteDataQuery Class Using LINQ to SharePoint Using SPMetal to Generate Entity Classes Demonstration: Generating Entity Classes in Visual Studio 2012

Approaches to Querying List Data Avoid enumerating list item collections Computationally expensive SharePoint provides alternative, optimized approaches SharePoint query classes SPQuery SPSiteDataQuery LINQ to SharePoint LINQ to SharePoint Provider SPMetal tool

Discussion: Retrieving List Data in Code When should you retrieve custom list data in code? What built-in alternatives should you consider before you retrieve custom list data in code?

Building CAML Queries The Where clause Using comparison operators Combining comparison operators 300 false

Using the SPQuery Class 1. Construct an SPQuery instance 2. Set CAML query properties 3. Call SPList.GetItems, passing the SPQuery instance SPQuery query = new SPQuery(); query.Query query text]"; var web = SPContext.Current.Web; var list = web.Lists["Company Cars"]; SPListItemCollection items = list.GetItems(query);

Using the SPSiteDataQuery Class 1. Construct an SPSiteDataQuery instance 2. Set CAML query properties 3. Call SPWeb.GetSiteData, passing the SPSiteDataQuery instance SPSiteDataQuery query = new SPSiteDataQuery(); query.Query query text]"; query.Webs "; query.Lists "; var web = SPContext.Current.Web; DataTable results = web.GetSiteData(query);

Using LINQ to SharePoint Use LINQ syntax to query SharePoint lists LINQ to SharePoint provider converts LINQ statements into CAML queries Requires generation of entity classes TeamDataContext teamWeb = new TeamDataContext(" var blueCars = from car in teamWeb.CompanyCars where car.Color.Contains("Blue") select car;

Using SPMetal to Generate Entity Classes Use the web option to indicate the target site Use the code option to specify the output code file Add user and password options to run in a different user context Use the parameter option to specify a parameter file for customized output SPMetal /web: /code:TeamSite.cs /password:Pa$$w0rd SPMetal /web: /code:TeamSite.cs /parameters:TeamSite.xml

Demonstration: Generating Entity Classes in Visual Studio 2012 In this demonstration, you will see how to use SPMetal to generate entity classes for a SharePoint site.

Demonstration: Generating Entity Classes in Visual Studio 2012

Lab A: Querying and Retrieving List Data Exercise 1: Querying List Items Exercise 2: Updating List Items

Lab Scenario The finance department at Contoso uses a SharePoint list to track capital expenditure requests and approvals. The team wants a quicker way to approve low-value requests in bulk. Your task is to create a custom Web Part that enables finance team members to rapidly locate all requests for expenditure of less than $500 and to approve these requests in bulk.

Lab Discussion: LINQ to SharePoint versus SPQuery In what scenarios do you think the LINQ to SharePoint approach might be the best choice? When do you think the SPQuery approach might be more appropriate?

Lesson 3: Working with Large Lists Understanding List Performance Management Overriding List View Thresholds Using the ContentIterator Class

Understanding List Performance Management Query throttling 5,000 items for users 20,000 items for auditors and administrators Happy hour Permit larger queries during daily time windows Allow larger queries at periods of low demand Indexing strategies Careful indexing makes queries more efficient

Overriding List View Thresholds Use the SPQuery.QueryThrottleMode property to override list view thresholds Object model overrides must be enabled at the web application level SPQuery query = new SPQuery(); query.Query query text]"; query.QueryThrottleMode = SPQueryThrottleOption.Override;

Using the ContentIterator Class Breaks queries down into manageable chunks Uses callback methods to process individual items var iterator = new ContentIterator(); iterator.ProcessListItems(list, query, ProcessItem, ProcessError); private void ProcessItem(SPListItem item) { // Process the individual list item. } private void ProcessError(SPListItem item, Exception ex) { // Log the error. }

Lab B: Working With Large Lists Exercise 1: Using the ContentIterator Class

Lab Scenario The finance team at Contoso has warned that the capital expenditure approval list may grow beyond 5,000 items. To avoid encountering problems with list query throttling limits, and the adverse performance impacts of submitting large list queries, you must modify the Web Part you created in the first exercise to use the ContentIterator class.

Module Review and Takeaways Review Question(s)

Module Review and Takeaways