object reference. objective how to work with objects in sharepoint by using classes?
TRANSCRIPT
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.
Lecture Step• Explain objective of the lab.• Explain related class.• Do the lab. Writing the code.• Point out the frequent bug.
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.
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.
Assignment• You as an IT developer; are assigned to develop content
management system for the Office of Human Resource Management (OHRM).
Design Workspace
Object Name & URL
Survey site collection by SharePoint Interface
• Open Vmware lab file from path:
myDocuments\KM WSS Office VS Student
Create Project• Open Visual Studio
Two ways of Code Implementation• Inline code• Code-behind
LAB 01.01OBJECTREFERENCE
Learning Objective• This lesson will learn about how to reference to objects, to
manipulate objects in the site collection by using different classes.
Related Class for SharePoint Object
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.
SITE COLLECTION
• Objective: how to create site collection object.• Class: SPSite
Class: SPSite
Page Load event
Frequent Bug• SPSite(“http://portal”) • It is ( ) parentheses. • Not [ ] bracket
REFER TO SITE / WEBSITE
• Objective• How to refer to Top-level site• How to refer to Site, Subsite
• Class• SPWeb
Class: SPWeb
Lab• Objective
• Enumerate Url of all sites in SiteCollection.• Enumerate Name of all sites in SiteCollection.
• Class• SPSite.AllWebs
Loop: foreach• The foreach statement allows you to iterate through all the
items in an array or other collection, examining each item in turn.
LIST OR DOCUMENT LIBRARY
• Objective:• Refer to all lists in site• Refer to specific List.
Lab: Enumerate all Title of Lists in site “DocCenter”
Refer to specific List.
LIST ITEM
• Objective• Reference all ListItem in List
• Class• SPList.Items
Class: SPList.Items
Lab: Enumerate Filename of all ListItem in List “Profile”
FOLDER
• Objective:• Reference folder including subfolder.
• Class• SPList.Folders
01.02ObjectReferenceDropDownList
Objective• Apply object reference to controls: DropDownList, ListBox.• Page processing sequence: page postback• Filter Lists
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.