Top Banner
Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development, LLC
22

Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Dec 18, 2015

Download

Documents

Buck Long
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: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint Object ModelA Basic Overview

Presented by: David SollPresident and CTO

Omicron Development, LLC

Page 2: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Agenda

IntroductionSharePoint VersionsSharePoint HierarchyObject ModelCode ExampleQuestions

Page 3: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

IntroductionPresenter: David F. Soll

President and Chief Technology Officer, Omicron DevelopmentTreasurer, PCJS IEEEVice Chair, Princeton/Central NJ IEEE Computer Society

Senior Member of the IEEERecipient of the IEEE Region 1 Award

Past Chair, Princeton Chapter of the ACMSenior Member of the ACM

Chair, TCF IT Professional ConferenceOver 30 years in computing

Page 4: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Versions of SharePoint

This presentation is valid for:SharePoint 2007SharePoint 2010SharePoint 2013

Page 5: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Object Hierarchies

A Collection Object contains other objectsThose objects can be collection objectsTherefore, A collection can contain a collection that contains a collection that contains an object (such as a document)

Page 6: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint Hierarchy

The Web Application Collection contains “Site Collections”A Site Collection is an object that contains a “Site”

Page 7: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint Hierarchy

An Item is the bottom level of the hierarchyAn Item contains the data

In a listIt contains the data fields

In a libraryIt contains the file

Page 8: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint HierarchyThe Web Application Object represents a virtual web serverA virtual web server is distinguished by:

IP AddressPortHost Header

Typically there are at least 2 Web Applications:SharePoint Central Administration v4

IP Address: All addressesPort: Randomly assignedHost Header: none

SharePoint – 80IP Address: All addressesPort: 80Host Header: none

Page 9: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint Hierarchy

A Site Collection always contains 1 siteThat site may other contain many sites

Security Principals for any site are contained in that site’s parent Site Collection

Even if it is up many levels of hierarchy

Page 10: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint Hierarchy

A Site object contains ListsNote that a Site itself is a ListTherefore a Site can contain other sites

There are different types of lists including:ListsExternal ListsLibrariesSites

An object in the list is called an Item

Page 11: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint HierarchyFarm

Web Application

Web Application

Site Collection

Site Collection

Site

List

Item

Item

List

Item

Item

Site

List

Item

Item

List

Item

Item

Site

List

Item

Item

List

Item

Item

Site

List

Item

Item

List

Item

Item

Web Application

Server Server

Page 12: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

SharePoint Farm

The Farm is the Top Level ObjectA Farm contains:

ServersService ApplicationsFeature Definitions

The Farm Object is tied to the Farm’s Configuration Database

It is not tied closely to content

Page 13: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Web Application Collection

SPWebApplicationCollection is the top level object for contentTo get the list of Web Applications:Dim WAC As SPWebApplicationCollectionWAC = SPWebService.ContentService.WebApplications

The SPWebApplicationCollection is a Collection object of SPWebApplicationDim App As SPWebApplicationFor Each App in WAC

…Next

Page 14: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Web Application Object

SPWebApplication is the Web Application ObjectYou can use the SPWebApplication.Lookup method to open a Web ApplicationDim WA As SPWebApplication = SPWebApplication.Lookup(new Uri("http://MyServer:989"))

Note: Uri is a object that is a member of System

Page 15: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Site Collection Object

The SPSiteCollection Object provides a mechanism for creating Site CollectionsIt also can be used to retrieve Site Collections based on execution contextExample:Dim WebApplication As SPWebApplication = SPContext.Current.Site.WebApplicationDim SiteCollections As SPSiteCollection = WebApplication.SitesDim SiteCollection As SPSiteFor Each SiteCollection In SiteCollections

...Next

Page 16: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Site Object (SPSite)

SPSite is a collection of sites in a Web application, including a top-level Web site and all of its sub-sitesEach SPSite object (site collection) is represented within an SPSiteCollection object that consists of the collection of all site collections in the Web applicationNote: Watch out for terminology. It seems to change based on the viewpoint. An SPSite is a Site Collection, not a site.

Page 17: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Web Object (SPWeb)

The SPWeb object represents a SiteIt contains a Webs property that represents a collection of sub-sitesExample:Dim SiteCollection As SPSiteDim RootWebSite As SPWebDim SubSite As SPWebSiteCollection = New SPSite("http://www.mySite.com")RootWebSite = SiteCollection.OpenWeb()For Each SubSite In RootWebSite.Webs

...Next

Page 18: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

List Object (SPList)

The SPList object represents a SharePoint list

Lists include:Document LibrariesCalendarsContact ListsCustom ListsIssue Tracking ListEtc. (Basically, anything within a site)

The SPWeb object has a Lists property that is a collection of SPList objects

Page 19: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Code Example

Caution: Ensure target is set to x64

Page 20: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Code Example

Include the following References:Microsoft.Office.ServerMicrosoft.SharePoint

Import the following (“using” in C#):Microsoft.Office.ServerMicrosoft.SharePointMicrosoft.SharePoint.Administration

Page 21: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Code Example

Link to demo code

Page 22: Omicron Development 16 Union Street Medford, NJ 08055 SharePoint Object Model A Basic Overview Presented by: David Soll President and CTO Omicron Development,

Omicron Development16 Union StreetMedford, NJ 08055

Questions