39
OBJECT REFERENCE

OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Embed Size (px)

Citation preview

Page 1: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

OBJECT REFERENCE

Page 2: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Objective• How to work with objects in SharePoint by using classes?

Page 3: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Learning Method• Help yourself and help your friends next to you.• You must address the bug by yourself.• I give you frequent bugs that allows you to know the point

to fix.• Lessons are designed to increment the content on the

previous lessons.

Page 4: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Lecture Step• Explain objective of the lab.• Explain related class.• Do the lab. Writing the code.• Point out the frequent bug.

Page 5: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Case Study’s Background• Office of Human Resources• It responses for

• Recruit employee• Manage salary, other benefits and tax• Check time attendance• Manage personnel development.

Page 6: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Existing Problem• There are a large amount of document in which the office

has to handle for thousands of employees. • These documents occupied the room space.• Searching these documents, it takes time.• The university has several campuses, transporting

document use a messenger. It takes time and document may be lost or damaged in travelling.

Page 7: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Assignment• You as an IT developer; are assigned to develop content

management system for the Office of Human Resource Management (OHRM).

Page 8: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Design Workspace

Page 9: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Object Name & URL

Page 10: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Survey site collection by SharePoint Interface

• Open Vmware lab file from path:

myDocuments\KM WSS Office VS Student

Page 11: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Create Project• Open Visual Studio

Page 12: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Two ways of Code Implementation• Inline code• Code-behind

Page 13: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

LAB 01.01OBJECTREFERENCE

Page 14: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Learning Objective• This lesson will learn about how to reference to objects, to

manipulate objects in the site collection by using different classes.

Page 15: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Related Class for SharePoint Object

Page 16: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Topic• SPSite

• Instantiate site collection object:

• SPWeb• Create web site object

• Top-level site, rootweb• Specific website• Compress form

• Enumerate all websites in site collection.

• SPList• Refer to all lists in site• Refer to specific List

• SPListItem• Refer to all ListItems in List• Refer to Folder in List

• SPField• Enumerate field name or column name in List.

• Display data in ListItem for a specific field.

Page 17: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

SITE COLLECTION

Page 18: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

• Objective: how to create site collection object.• Class: SPSite

Page 19: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Class: SPSite

Page 20: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Page Load event

Page 21: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Frequent Bug• SPSite(“http://portal”) • It is ( ) parentheses. • Not [ ] bracket

Page 22: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

REFER TO SITE / WEBSITE

Page 23: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

• Objective• How to refer to Top-level site• How to refer to Site, Subsite

• Class• SPWeb

Page 24: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Class: SPWeb

Page 25: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Lab• Objective

• Enumerate Url of all sites in SiteCollection.• Enumerate Name of all sites in SiteCollection.

• Class• SPSite.AllWebs

Page 26: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Loop: foreach• The foreach statement allows you to iterate through all the

items in an array or other collection, examining each item in turn.

Page 27: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

LIST OR DOCUMENT LIBRARY

Page 28: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

• Objective:• Refer to all lists in site• Refer to specific List.

Page 29: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Lab: Enumerate all Title of Lists in site “DocCenter”

Page 30: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Refer to specific List.

Page 31: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

LIST ITEM

Page 32: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

• Objective• Reference all ListItem in List

• Class• SPList.Items

Page 33: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Class: SPList.Items

Page 34: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Lab: Enumerate Filename of all ListItem in List “Profile”

Page 35: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

FOLDER

Page 36: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

• Objective:• Reference folder including subfolder.

• Class• SPList.Folders

Page 37: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

01.02ObjectReferenceDropDownList

Page 38: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Objective• Apply object reference to controls: DropDownList, ListBox.• Page processing sequence: page postback• Filter Lists

Page 39: OBJECT REFERENCE. Objective How to work with objects in SharePoint by using classes?

Requirement

1. When a program is loaded, the dropdownlist displays all websites in the site collection.

2. When a user selects a website from DropDownList, Lists associated under the website will display in ListBox.

3. Lists will be filtered Non-hidden list.