SlideShare ist ein Scribd-Unternehmen logo
1 von 91
Chapter 1—1 of 1
Sharepoint Development Core Solution 70-488 Skills measured
Eng.ahmed mostafa tawfik
Sharepoint 2013 solution developer
@AMostafaTawfik
Thanks to everyone support me to finish these notes
special thanks to:
Eng.Mahmoud Hamed Mahmoud
SharePoint | Office365 Evangelist, Architect, Developer
@mhamedmahmoud
This exam measures your ability to accomplish the technical tasks listed below. The percentages indicate the relative
weight of each major topic area on the exam. The higher the percentage, the more questions you are likely to see on
that content area on the exam.
Please note that the questions may test on, but will not be limited to, the topics described in the bulleted text.
Chapter 1—1 of 8
Chapter 1 Plan and design SharePoint sites (10‒15%)
Manage the site life cycle
Create a delayed site collection
// “Select template later “ Create an empty site and pick a template later time
SPSiteCollection.Add("/sites/site1", "SharePoint", null, 1033, null, "administrator",
"Administrator","admin@contoso.com")
Manage site collection disposition
1.1.1. Site Policy in SharePoint(Blog Post)
Site Policies allow you to create a retention policy that can be applied to a site. Site Policy includes the
following options:
1-Site Closure: The date the site is put into a "Closed" state.
denote that the site is not being actively used any longer and will be moving to the next site lifecycle
stage. Sites can be manually closed. Site owners can also manually reopen closed sites .
2-Site Deletion: The period of time following site creation or site closure that the site should be
permanently deleted. When a site is deleted all its content and sub-webs are also deleted.
3-Postponement: This option will allow a site owner to manually postpone site deletion for a period of
time determined by the Site Policy.
4-E-mail Notification: Before a site is deleted, an e-mail will be sent to site owners alerting them about the
pending site deletion. Site Policy determines the period of time before scheduled site deletion that the e-
mail is sent as well as recurrence frequency and timing of the e-mail alert.
5-Read-Only Mode: This setting puts the site collection and its subwebs into a read-only mode upon
closure. Users can contact administrators to manually reopen the read-only site collection if need.
1.1.2. ProjectPolicy.CloseProject(SPWeb web)
public static void CloseProject(SPWeb web) //Closes the site.
this site must have a policy applied and opened.
1.1.3. ProjectPolicy.GetCurrentlyAppliedProjectPolicyOnWeb
// Returns the policy that is applied on the site , Null if there is no policy applied on the site.
public static ProjectPolicy GetCurrentlyAppliedProjectPolicyOnWeb(SPWeb web)
Identify inactive site collections
1.1.4. SPSite.LastContentModifiedDate
public DateTime LastContentModifiedDate { get; } //return System.DateTime object contain date
//Gets the date and time when the content of the site was last changed.
1.1.5. SPSite.LastSecurityModifiedDate
public DateTime LastSecurityModifiedDate { get; } //return System.DateTime object contain date
//Gets the date and time when security on the site was last changed .
Back up and archive site collection data
Programatically:
SPWebApplication myApp = SPWebApplication.Lookup(“url_of_Web_app”)
SPSiteCollection mySiteCols = myApplication.Sites;
// A-Backup
mySiteCols.Backup(@"full url site collection", @"Path+file name", override previous backup or not);
mySiteCols.Backup(@"http://Server/sites/MySiteCollection",
@"OtherServerWSSBackupsSiteCollectionsBackupOfMySiteCollection", true);
// B- Restore
Chapter 1—2 of 8
mySiteCols. Restore (@"full url site collection", @"Path+file name", override exist site collection or not);
mySiteCols.Restore(@"http://Server/sites/MySiteCollection",
@"OtherServerWSSBackupsSiteCollectionsBackupOfMySiteCollection", true);
Data Protection and Recovery
Database Mirroring and Failover
Database Snapshots
SPBackupRestoreConsole Class
//Provides static methods for running and managing backup and restore operations.
Create content types
Subscribe to published content types
Introduction to Content Types
(1) Definition: A content type is a reusable collection of metadata (columns), workflow, behavior, and
other settings for a category of items or documents in SPList or SP Document Library manage the
settings for this category in a centralized, reusable way and can be inherited,enableing Standarize by
using it in all WebSite in the SiteCollection , Content Types are File Format Independent could be
applied to any file format (word ,ppt,..) or without format (List Item ,Folders ,..).
(2) Content Types Encapsulate Data Requirements , can include the following information:
1. The metadata, or properties, you want to assign to this type.
2. Custom New, Edit, and Display forms to use with this content type.
3. Workflows available for items of this content type.
4. Document template For document content types
Any information necessary for custom solutions that are associated with this content type as XML .
(3) Site and List Content Types:
 Site Content Type: Content Type created on siteCollection but has not yet been added to list.
 List Content Type: A Copy of the site content type and added to the list.
(4) Default List Content Types:
 every item has a content type assigned to it, either implicitly or explicitly ,so the list schema
actually functions as the default content type of the list itself. Example Create an announcement
list, and SharePoint Foundation copies the Announcement site content type locally to the list as
the default list content type, create a document library and so on.
(5) Content Type Scope:
 All WebSites in the SiteCollection and every SubSite .
(6) Content Type IDs:
Content type IDs uniquely identify the content type and are designed to be recursive.
 Rules of Assignment:
The three most important built-in content types are Item, Document, and Folder. Any content
type that you assign to a document library must inherit from Document or from a content type
derived from Document. Moreover, any content type that you assign to a list must not derive
from Document. The exception to this pair of rules is the Folder content type can exist on both
lists and document libraries.
(7) Content Type Groups:
 The built-in content types are organized in groups such as List Content Types, Document
Content Types, Folder Content Types, and “_ Hidden”.
 you can create your Group for your Content Type.
Chapter 1—3 of 8
(8) Designing Content Types you should Consider:
A. Scope. Where in the site hierarchy do you want the content type to become available?
B. Parent. Which existing content type you choose to derive your content type from?Your content
type will not activate correctly if the parent content type is not available in the website where your
content type is created.
C. Columns. Which existing site columns are available for you to use plus Columns that are not
inherited .
D. Other Resources. Will the content type require language resources? Document templates? Forms?
(9) Updating Content Types 2 Approaches:
1. Make the necessary changes to the content type // if you must make targeted, discrete changes
to a content type that is in use.
2. Create a new content type with the necessary changes, deploy it wherever the previous content
type exists, and then add the previous content type to the _Hidden content type group.
// replace a content type that is currently in use , but still retain the current content type for items
that are already assigned that content type.
 Sealed Content Types can not updated before set sealed property to false
(10) Deleting Content Types :
cannot delete a site content type if it is being used as the basis for other site or list content types,
otherwords you must be sure that the GetUsages method returns an empty list
Subscribe to published content types
i) How to: Customize Content Type Syndication
(a) Ensure uniformity across lists so that they use the same content types, and therefore the same
columns.
(b) Content type can be shared within the farm or outside the farm with the managed metadata
service application.
(c) You can use the object model ContentTypePublisher class to customize content type syndication
to create a new content type, publish it, and unpublish it on the hub site.
ii) ContentTypePublisher
Publishes or unpublishes a content type on the hub site.
Methods: (Publish, Unpublish, IsPublished, IsContentTypeSharingEnabled )
Choose appropriate content type creation Using 3 ways:
1-SharePoint Foundation user interface. //UI
2- SharePoint Foundation object model. //Code
3-Deploying a Feature that installs the content type based on an XML definition file. //Declaretive
 Except these you are defining content type not creating content type.
1.2. use Schema Development
The Content Type Definition Schema defines the structure of the XML that creates a content type in the
element manifest file of a Feature.
<Elements Element (ContentType)>
<ContentType Element (ContentType)>
<Folder Element (ContentType) />
<FieldRefs Element (ContentType)>
<FieldRef Element (ContentType)>
<RemoveFieldRef Element (ContentType)>
<XmlDocuments Element (ContentType)>
<XmlDocument Element (ContentType)>
<DocumentTemplate Element (ContentType)>
1.3. create content types using Object Model
Chapter 1—4 of 8
SPWeb..> SPContentTypeCollection....> new SPContentType object....> Add(SPContentType) method of
the SPContentTypeCollection
Create site columns.
A. Introduction to Columns
 A site column is a reusable column definition, or template, that you can assign to multiple lists across
multiple SharePoint sites.
 Column Properties:
1. Name The column name must be unique among all column groups at the scope at which you
create it.
2. Data type for example, single or multiple lines of text, number, currency, date and time, or
calculation.
3. Detailed optional settings any other optional settings to apply for the data type you selected.
4. Column group to which this column belongs user-defined groups that help you organize your
columns into logical categories.
 Unlike content types, you cannot create a site column based on another site column.
B. Updating Site Columns
 write code that updates the site column, and then call the Update method.
 SharePoint Foundation never writes changes made to a site column back to the site column definition
itself. Instead,it stores updates made to site columns as entries within the SharePoint Foundation
database.
C. Fields and Field References
Site Columns and List Columns are represented as either Field or FieldRef Element
 Field elements ..............>> in site and list definitions (schemas).
 FieldRef elements ......>> in content type definitions (schemas).
You cannot create a column in a content type; you must create the column and then reference it in the
content type definition.
D. Enforcing Uniqueness in Column Values
 New feature called unique column constraints, As stated.
 a column that enforces a uniqueness constraint must be indexed.
 SPField custPhone = custList.Fields["Phone Number"];
 custPhone.Indexed = true;
 custPhone.EnforceUniqueValues = true;
 custPhone.Update();
E. Lookups and List Relationships
 A lookup field is a field that is configured to get its value from a field in another list, When users
create a new item, they do not type a value for the lookup column. Instead, they select a value from a
drop-down list of the values in the column on the other list.
 The SPList class has a GetRelatedFields method that you can use to discover lookup fields that point
to a list.
 List Relationships and Data Integrity:
When you create or edit a lookup column through the user interface, you have the option to Enforce
relationship behavior. If you select this option, you can then select either Restrict delete (Prevent
Delete)or Cascade delete(Delete Related Field).
 For SharePoint Foundation to either restrict or cascade deletions, the lookup field must be indexed.
 A side-effect of choosing either to cascade or to restrict deletions is that the values of lookup fields
are validated when they are set.
 Creating Multiple-Column Lookups: create multiple-column lookups to the same lookup list.
 // Create the primary column.
 List.Fields.AddLookup(,,)
 // Create the secondary columns.
 List.Fields.AddDependentLookup(,,)
 Discovering List Relationships:
Chapter 1—5 of 8
You can discover which fields in related lists depend on information in a lookup list by calling the
GetRelatedFields method on an SPList object that represents the lookup list. The method returns a
collection of SPRelatedField objects.
Content type inheritance:
 SPContentType class //Represents a site or list content type.
 public sealed class SPContentType
Where a content type is used as the basis for another content type
 SPContentTypeUsage class: //Used to track where a content type is used as the basis for another
content type.
 GetUsages(SPContentType) method, which returns a generic list of SPContentTypeUsage objects.
1.4. ContentTypeBinding Element:
 Specifies a content type to provision on a list defined in the onet.xml schema.
 Lists defined in the onet.xml schema cannot be modified directly.
Manage content type behaviors
Manage event receivers
The SharePoint Foundation event model is built upon a common set of components and concepts, which are
summarized in the remaining sections:
1. Before and After Events:
a) Before events “ing” are always synchronous.
b) After events “ed” execute in a different process from the triggering action, they can execute
either synchronously or asynchronously.
2. Event Hosts: are objects, such as site collections, Webs, lists and list items, that expect to receive
events – or, in other words, objects whose event receivers “listen” for SharePoint Foundation events.
3. Event Receivers and Handling Events:
Event handler code is compiled into a .dll file and deployed to the GAC.
i. create a new project of type "class library" and then inherit from one of the event receiver base
classes.
ii. override wanted methods
iii. Binding ....77
4. Binding Event Handlers: “register” or binding is the process by which event handler code is
associated with an object type by two ways:
a) Declarative XML within a SharePoint Feature, either by list type or by content type, When you
define a content type with a feature, you create two XML files:
1. Feature.xml: Define the metadata for the new feature.
2. Elements.xml: Define the assembly that encapsulates the event handler, the class
itself, and also a sequence number that specifies the order, if multiple event handlers
are associated with the Feature.
b) Code that implements classes in the SharePoint object model.
 SPList list = web.Lists["Shared Documents"];
 SPEventReceiverDefinition def = list.EventReceivers.Add();
 def.Assembly = "ERDefinition, Version=1.0.0.0, Culture=Neutral,
PublicKeyToken=704f58d28567dc00";
 def.Class = "ERDefinition.ItemEvents";
 def.Name = "ItemAdded Event";
 def.Type = SPEventReceiverType.ItemAdded;
Chapter 1—6 of 8
 def.SequenceNumber = 1000;
 def.Synchronization = SPEventReceiverSynchronization.Synchronous;
 def.Update();
5. Event Troubleshooting:
a) The event behaviors has some issues should solved for events to work correctly
manage workflow associations
 public SPWorkflowAssociationCollection WorkflowAssociations { get; }
SPContentType.WorkflowAssociations property: Gets an SPWorkflowAssociationCollection object that
represents the workflow associations for this content type.
 You can test for the existence of a workflow association in the content type’s collection by calling the
GetAssociationByName method. If the return value of that method is not a null reference
manage policies
1. An information management policy is a set of rules that govern the availability and behavior of a
certain type of important content.
2. Policies provide the following benefits:
1.Administrators can set and manage "the rules" for a content type from a single location,
including both client-side policy features and server-side policy features.
2.Policies are tightly coupled to the content.
3.Policies require little involvement from end users, because corporate policies are automatically
and transparently followed.
3. Policy Architecture
each policy is a collection of instruction sets for one or more policy features. Each policy feature
provides a specific kind of content management functionality. You can assign a policy to a content
type or to a list.
4. You can assign only one policy to a given content type or SharePoint list. However, that policy can
contain any number of policy items.
manage document templates
 DocumentTemplate Element (ContentType): Specifies the document template for the content type.
This is the file which SharePoint Foundation opens as a template when a user requests a new item of
this content type.
1.5. Managing Document Templates with Content Types and Content Type Hub:
If you are working on a hub site that publishes content types to other site collections, you can:
a) Publish content types to make them available for use on subscribing sites.
b) Republish content types so that subscribing sites can receive updates.
c) Unpublish content types.
 You have to run stsadm command to see the Content type publishing option appear in Site Collection
Administration
1.6. Deploy a content type across a number of site collections:
1. Using content publishing: Setup the content type hub then Create a feature that contains a
content type with a document template, and the document template itself then Deploy the
feature to the farm, finally activate the feature on the content type publishing hub site collection.
2. Without using content publishing: using a site scoped feature then the _layouts approach is the
only solution to make it easy by using a library to contain the templates Document templates need
to be stored either in the 1- site collection where the content type is defined, or 2- in <SharePoint
root>/Templates/Layouts (_layouts).
Chapter 1—7 of 8
1.7. Deploying a Document Template file in Content Type in a (Office365) Sandboxed Solution:
SP Root folder “15” is not accessible in Sandboxed solutions and hence it is not possible to deploy the
document templates in _layouts folder, You will need to include the document template within SharePoint,
meaning it will be stored in the content database.
Steps:
1. Create and Configure a Module: In this step, you create a feature manifest file that contains a
Module element. This specifies which files to deploy and where to deploy them.
2. Add the Module to a Feature: In this step, you create a feature and add your feature manifest
file to the feature. This enables you to deploy the module to the SharePoint environment.
Solution:
a) Add the Templates module under your content type and delete the default files Sample.txt and
Elements.xml added.
b) Edit the content type Elements.xml and add the Module definition just before declaring the
content type.
c) update the DocumentTemplate reference in the content type definition.
d) Deploy and test your solution.
Implement site provisioning
Create site definitions
 A site definition defines a unique type of Microsoft SharePoint Foundation website.
 To create a custom site definition with one or more configurations, follow the procedures:
 Declarative task no code used
 Adding (CAML) markup to two critical files: a WebTemp*.xml file and an Onet.xml file.
 May create one or more custom site pages.
 For globalization, you can also use of one or more resource (.resx) files.
 do not edit the original WebTemp.xml file. Instead, create a custom WebTemp*.xml file
 WebTemp.xml you are creating will be merged with the built-in file. Do not change the built-in
file. The name of your custom file must match the pattern WebTemp*.xml.
 Configuration: Specifies the set of lists, Features, and modules that are included when a site is
created.
 Modifying site definition:
1.SharePoint Designer :Modify site definition files to customize existing sites or lists is not supported.
2.Object model to modify sites after they are created.
 Four site definitions whose configurations can be used to create new websites.
1.STS includes configurations for, Blank Site, Team Site, and Document Workspace.
2.MPS includes configurations for Basic Meeting Workspace, Blank Meeting Workspace, Decision
Meeting Workspace, Social Meeting Workspace, and Multipage Meeting Workspace.
3.BLOG provides a site definition configuration for blogs.
4.SGS provides a site definition configuration for Group Work Site.
 Core Schema Files:
 WebTemp*.xml Files: Identify the site definitions, configurations and appearnce in the user
interface (UI).
 Onet.xml Files: Define the navigation areas, specify document templates and their files, define the
base types for lists, and define configurations and modules for site definitions.
 Each of these XML files uses (CAML) to define various aspects of a site.
create web templates
 created by two ways:
Chapter 1—8 of 8
1. UI:When a user customizes a website in the (UI) or Microsoft SharePoint Designer, and then saves the
website as a template, a web template is created, and stored in the Solutions Gallery of the top-level
site in a site collection, where they become available for subsite creation on all websites in the site
collection.
2. Code: by create new project Import SharePoint Solution Package project as sandboxed solution,
then Download the solution (.wsp) file from the Solution Gallery and point to it as the project source,
finally edit the files as needed (WebTemplate element, Onet.xml file,...).
 A web template is persisted in the SharePoint database as a Solution, which is a file .wsp extension, a
.wsp file is actually a .cab file (library of compressed files stored as a single file).
 Web templates can be downloaded, edited, and redeployed as a sandboxed solution to other site
collections.
 Easy to create, are easy to Deploy, modified without affecting the sites that have been created.
implement feature stapling “Feature/Site Template Association”
allow you to associate new Features and functionality with existing site definition configurations
Two Features are involved in a Feature/site template association:
1. the Feature containing the functionality you want to add to an existing site definition configuration.
2. The Feature/site template association.
Possible scopes:
a) Farm: Yes
b) Web Application: Yes
c) Site Collection: Yes
d) Web Site: No
implement custom provisioning code
public abstract class SPWebProvisioningProvider ( )
//Provides a handler for responding to Web site creation.
use ApplyWebTemplate method
Chapter 2—1 of 82
Chapter 2 Implement authorization and authentication (10‒15%)
Implement user authentication
Create a custom claims provider
 Introduction to Creating Custom Claims Providers in SharePoint
 There is two security models:
A. Classic Mode: older version
B. Claims Mode: new model
 When a web application that runs in Claims Mode authenticates a user, it creates a security token for
the user by using Security Assertion Markup Language (SAML).
 What is powerful about creating a custom claims provider is that your code is called each time the
hosting web application authenticates the user and creates a SAML token. Your code is then given the
opportunity to do the following:
1) Determine who the user is.
2) Query for information about the user.
3) Add claims about the user into the resulting SAML token.
4) A custom claims provider supplies an important point of interaction for SharePoint site
administrators who are configuring permissions on lists and sites.
 Two Types of claims providers:
a) People picker claims provider:
enable a user to search and resolve entities in the standard people editor controls provided by
SharePoint Foundation.
b) Claims augmentation provider:
Used to augment the claims (such as attributes) of a user. For example, can add custom claims
to a user's security token, which provides more flexibility when you configure permissions on
sites, lists, items, and documents.
 Code:
 Add new class that inherits from SPClaimProvider, add a public constructor that takes a single string
parameter and passes it to the base class constructor.
class AudienceClaimProvider : SPClaimProvider {
public AudienceClaimProvider(string displayName): base(displayName) {} }
 Define one or more claim types. A claim type is identified by a unique string, and by URI
 A claims provider requires a name and a description for registration internal const string.
 SPClaimProvider has several methods and properties that you must override.
 bring the claims provider to life, using two methods FillClaimTypes and FillClaimValueTypes ,
FillEntityTypes.
 Adds claims to the user's SAML token.
 implement the methods of the SPClaimProvider class that interact with the People Picker page:
FillSearch : search in the People Picker page, creates a picker entity object for each audience match
by using a utility method named CreatePickerEntityForAudience,
 Conclusion
The ability to create custom claims providers for Microsoft SharePoint, enables you to move beyond simple
security schemes where permissions can be configured only in terms of user account names and groups. By
adding custom claims into the SAML security tokens of your users, you can make it possible for site
administrators to configure security permissions in terms of new abstractions—such as Users Over 21,
Naturalized United States Citizens, Managing Partners.. .
package and deploy a custom claims provider
 SPClaimProviderFeatureReceiver class:
Defines a class for provisioning and unprovisioning a single claim provider.
 [SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]
 public abstract class SPClaimProviderFeatureReceiver : SPFeatureReceiver
Chapter 2—2 of 82
create a custom membership provider &package and deploy a custom membership provider
 Claims Walkthrough:
Learn how to create forms-based authentication for claims-based web applications by using a custom
membership and role provider as the authentication provider..
 Overview of Authenticating Claims-Based Web Applications by Using Custom Membership and Role Providers
1: Reviewing the Membership and Role Provider Code
2: Building and Deploying the Membership and Role Provider
3: Creating a SharePoint Web Application
4: Configuring the Membership and Role Provider for the SharePoint Web Application
5: Testing Forms-Based Authentication
6: Viewing Claims
 Conclusion: Forms-based authentication provides custom identity management
create a custom sign-in page with Forms Based Authentication.
 Configure Forms Based Authentication in SharePoint
 Create a New SharePoint Application choose “Claims Based Authentication” for the Authentication type,
create the site collection.
 Enable and configure the forms based authentication settings.
1) Create the database using aspnet_regsql
2) Add users and roles using the Web Site Administration Tool
3) Add connection strings in the web.config for:
 Your application
 Central Administration
 Secure Token Service Application
4) Add membership and role providers for:
 Your application
 Central Administration
 Secure Token Service Application
5) Edit web.config for Central Administration
 Set the default provider for roles as AspNetWindowsTokenRoleProvider
 Set the default provider for membership as your new membership provider
 Add the PeoplePickerWildcards entry
6) Edit web.config for the Secure Token Service Application
 Set the default provider for roles as your provider
 Set the default provider for membership as your provider
7) Add the FBA administration user to Central Administration
8) Add FBA roles to SharePoint groups
Creating a Login Page:
A. Create new Empty SharePoint Project.
B. Choose Farm Solution.
C. Add a new item to the project “Application Page”.
D. Add a reference to the assembly “Microsoft.SharePoint.IdentityModel”.
E. Update the markup for the page.
F. Create the code-behind for the page.
G. Inherit from FormsSignInPage
Configure your custom login page:
1. In Central Administration, click on “Manage web applications”.
2. Click your web site. Then click the “Authentication Providers” ribbon button.
3. Finally choose the zone that you want to configure, enter Sign In Page URL.
Chapter 2—3 of 82
authenticate a user from a client application
The 3 Object Models with their available authentication methods are:
1. .NET Client Object model
o The default is to authenticate users via their current Windows credentials (NTLM and Kerberos).
o Possible for you to define other authentication methods like Anonymous or Forms Authentication.
2. Silverlight Client Object model
o Default is to authenticate users via their current Windows credentials (NTLM and Kerberos).
o It is possible for you to define other authentication methods like Forms Authentication.
o It is not possible to use the Silverlight client object model with anonymous authentication.
3. ECMA Script Client Object model
o No need for additional authentication as JavaScript already runs in an authenticated page.
ClientContext clientContext = new ClientContext("http://ltp-21:31890");
//Set the AuthenticationMode
clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication;
//Instantiate a FormsAuthenticationLoginInfo object.
FormsAuthenticationLoginInfo formsAuthInfo = new
FormsAuthenticationLoginInfo("MyFormsTestUser", "MyUserPassword!2");
//Specify the login details using the FormsAuthenticationLoginInfo object.
clientContext.FormsAuthenticationLoginInfo = formsAuthInfo;
Web site = clientContext.Web;
clientContext.Load(site);
clientContext.ExecuteQuery();
Console.WriteLine("Title: {0}", site.Title);
 Using the Client Object Model with a Claims Based Auth Site:
1.1. What's new in SharePoint 2013 for authentication, authorization, and security?
A. User sign-in:
 SharePoint 2013 continues to offer support for both claims and classic authentication modes.
 Claims authentication is the default authentication option in SharePoint 2013.
 Classic-mode authentication is deprecated and can be managed only by using PowerShell.
 The MigrateUsers method from SharePoint 2010 is now deprecated, it's no longer the correct
way to migrate accounts. To Migrate accounts from classic-mode in SP2010 to claims-based
authentication in SharePoint 2013, use the new Windows PowerShell cmdlet called Convert-
SPWebApplication.
 Requirement to register claims providers is eliminated. However, you do have to pre-configure
claims type.
 SharePoint 2013 tracks FedAuth cookies in the new distributed cache service using Windows
Server AppFabric Caching.
 Significantly more logging is provided to help troubleshoot authentication issues.
B. Services and app authentication:
 A app for SharePoint has its own identity and is associated with a security principal, called an app
principal. Like users and groups, an app principal has certain permissions and rights.
 In SharePoint 2013, the server-to-server security token service (STS) provides access tokens for
STS authentication. The STS enables temporary access tokens to access other application services,
such as Exchange Server 2013 and Microsoft Lync 2013, and apps for SharePoint 2013.
Authentication and authorization
 SharePoint 2013 supports security for user access at the website, list, list or library folder, and
item levels, making it easier to manage user rights and group rights throughout a website.
Chapter 2—4 of 82
 Authorization: which users can perform specific actions on a given object.
 Authentication: Windows authentication or non-Windows authentication.
 Windows authentication: allows IIS to perform the authentication for SharePoint 2013, supporting
all (IIS) and Windows authentication integration options, including Basic, Digest, Certificates,
Windows NT LAN Manager (NTLM), and Kerberos.
 ASP.NET Forms: A non-Windows identity management system that uses the ASP.NET forms-
based authentication system.
Claims-based identity and authentication
 Claims-based identity is an identity model in SharePoint 2013 that includes features such as
authentication across users of Windows-based systems and systems that are not Windows-based,
multiple authentication types, stronger real-time authentication, a wider set of principal types, and
delegation of user identity between applications, supporting The following sign-in or access modes:
a) Windows claims–mode sign-in (default)
b) SAML passive sign-in mode
c) ASP.NET membership and role passive sign-in
d) Windows classic–mode sign-in (deprecated in this release)
 Single sign-on is much easier to achieve, and your application is not responsible for the following:
i. Authenticating users
ii. Storing user accounts and passwords
iii. Calling to enterprise directories to look up user identity details
iv. Integrating with identity systems from other platforms or companies
Forms-based authentication
 provides custom identity management in SharePoint 2013 by implementing: a
a) Membership provider, defines interfaces for identifying and authenticating individual users.
b) Role manager, which defines interfaces for grouping individual users into logical groups or roles.
 The membership provider validating the credential information by using
the System.Web.Security.Membership.ValidateUser method
 The role manager is optional. If a custom authentication system does not support groups, a role
manager is not necessary.
 SharePoint 2013 supports one membership provider and one role manager per URL zone.
 The ASP.NET forms roles have no inherent rights associated with them. Instead, SharePoint 2013
assigns rights to the forms roles through its policies and authorization.
 In ASP.NET membership and role passive sign-in, the sign-in happens by redirecting the client
to a web page where the ASP.NET log-in controls are hosted. After the identity object that
represents a user identity is created, SharePoint 2013 converts it to a ClaimsIdentity object
(which represents a claims-based representation of a user).
Implement application authentication and authorization
Use the SharePoint App TokenHelper class
Authorization, users, groups, and the object model in SharePoint 2013
1) Introduction
i) Access to SharePoint 2013 objects is controlled through a role-based membership system by which
users are assigned to roles that authorize their access to SharePoint 2013 objects.
ii) Groups consist of users and may or may not be assigned to roles. SharePoint 2013 includes the
following three groups by default:
 owners (administrator)
 members (contributor)
 visitors (reader)
2) Security policy
Chapter 2—5 of 82
 provides a way to enforce uniform security throughout all site collections within a web application
 In policy roles, the users and groups are identified by both their security identifier (SID) and their login
or user name.
 Central administration policy roles differ from the role definitions for a site collection.
3) Users, groups, and principals
user (SPUser) gains access to a SharePoint object two ways:
I. directly through an individual role assignment, ..> the user is the principal
II. indirectly through membership in either a domain group or a SharePoint group (SPGroup) that has a
role assignment, ...> the domain group or SharePoint group is the principal
user-based permissions management through two ways:
1) access control lists (ACLs) for small number of users.
2) Group-based for larger number of users.
SharePoint Server groups supports two kinds of:
i. Domain groups: remain outside SharePoint Server control; users cannot use SharePoint Server to
define, browse, or modify domain group membership, Domain groups can be used anywhere within
the scope of the Active Directory directory service.
ii. SharePoint groups: are scoped to the site-collection level, and they can be used only within the site
collection.
 Principal is a user or group that is used to control security:
A. If you add a user to a site, the user is the principal, but
B. if you add a group to the site, the group is the principal.
 By using groups, a smaller number of principals can be used to grant access to a much larger number of
users.
4) High-level view of object relations—scopes, users, groups, and roles
A scope represents a uniquely secured object
or set of objects. [site, list, folder or item
level]
Users groups (N : N):Each user (SPUser) can
be a member of multiple groups, and each
group (SPGroup) can contain multiple users.
Rights and role definitions (N to N):
 Right”insert list item ” can be in multi role
defnitions [Contributor, Designer, and
Administrator]
 Role definition “Contributor” can also
contain multiple rights. [inserting,
updating, and deleting list items].
5) User tokens and access control lists
 To make checking permissions faster, SharePoint Server implements user tokens and ACLs in its
security model.
 The user token identifies the authentication process applied to a user.
 ACL is a binary object that determines the rights that users and groups have on a given object.
 An ACL consists of multiple ACEs, each security principal (user or group) being one ACE in the ACL
6) Object model changes: obsolete but backward-compatible security objects
The following security objects used in WSS 2.0 are obsolete, but continue to function:
I. Microsoft.SharePoint.SPPermission
II. SPPermissionCollection
III. SPRights
IV. SPRole
Chapter 2—6 of 82
V. SPRoleCollection
Replaced by:
i) SPBasePermissions “Right”
ii) SPRoleDefinition “RoleDefinition”
iii) SPRoleAssignment “RoleAssignment”
7) Guest roles (Limited Access) to accommodate shared resources
 The concept of a guest role is extended to include folder-level permissions and list-level
permissions.
 When a user is granted permissions on a folder, they are also granted the Guest role on the
parent list of that folder and on the parent website
8) Removing users from a scope or from all scopes
The only way to remove a user from all scopes is to delete that user from the site collection, which
removes the user from all roles in all scopes within the site collection.
1.2. Use the SharePoint App TokenHelper class,
App authentication in SharePoint
i. The authentication process verifies a claim that is made by a subject (in this case, an app) that it should be
allowed to act on behalf of a given principal (in this case, an authenticated SharePoint user)
Authorization policies:
 The authorization process verifies that an authenticated subject (an app or a user or both) has
permission to perform certain operations or to access specific resources
 three types of authorization policies:
a) User-only policy.In SP2010 content database authorization checks succeed if user has permissions
b) App-only policy, Ex:expense submission app. if App has permissions
c) User + app policy. App Part “iframe” if user +App permissions
 App permissions and app permission request scopes
App developer should specify through the app manifest file, the permissions an app needs to SharePoint
resources outside the app web.
OAuth 2.0 in SharePoint 2013:
 OAuth 2.0 is an open framework for authorization.
 OAuth enables secure authorization from desktop and web applications in a simple and standard way.
 OAuth enables a user to approve an application to act on his or her behalf without sharing his or her user
name and password.
 For example, user can share private resources (documents, photos, videos and so on) on one site with
another site, without requiring credentials (typically user name and password).
 OAuth enables users to provide access tokens, instead of credentials, Each token grants access to a specific
resource provider (website) for specific resources (ex:documents in a SharePoint document library) and for a
defined duration (ex:12 hours)
A typical apps for SharePoint scenario is as follows:
1) A user signs in to SharePoint and is authenticated.
2) The authenticated user then installs an app for SharePoint from either the Office Store or the app catalog.
3) The app is granted permission by the user to access SharePoint resources.
4) When an authenticated user (not necessarily the same one who installed the app) launches the app,
SharePoint POSTs a context token to the app.
5) The app then calls back to SharePoint to access the SharePoint resources on behalf of the user by using an
access token.
When is OAuth used?
i. If you plan to build an app for SharePoint that runs in an remote web application and communicates
back to SharePoint using server-side code.
Remote Web application:
 Off premise: use the ACS authorization system in which ACS is the token issuer.
Chapter 2—7 of 82
 On premise: use the high-trust system in which the app itself and a digital certificate are the
token issuers.
ii. The OAuth 2.0 framework uses token passing "flows" to:
a) Authorize requests by an app for SharePoint to access SharePoint resources.
b) Authenticate apps in the Office Store, an app catalog, or a developer tenant.
 When is OAuth not used?
 When make a call from the app web itself or from JavaScript a remote webpage using the cross-
domain library.
 Access tokens:
 To access resources, an app has to request an access token from an OAuth security token service (STS)
 In contrast, the WS-Federation STS and the Security Assertion Markup Language (SAML) passive sign-in
STS are primarily intended to issue sign-in tokens.
 An example of an OAuth STS is Microsoft Azure Access Control Service (ACS).
 OAuth STS is not used for issuing sign-in tokens, that is, they are not used as identity providers. So, you
will not see an OAuth STS listed in the user sign-in page, the Authentication Provider section in Central
Administration, or the people picker in SharePoint.
specify the App permission request scope manifest and permission request manifest:
 Certain APIs require a user context and can't be executed with an app-only policy.
 Apps that do not make OAuth authenticated calls (for example, apps that are only JavaScript running in the
app web) cannot use the app-only policy. They can request the permission, but they will not be able to take
advantage of it because doing so requires passing an app-only OAuth token. Only apps with web applications
running outside of SharePoint can create and pass app-only tokens.
 OAuth and server-to-server calls should use the app-only policy if:
 The app needs to elevate its permissions above the user for a specific call (for example, to approve an
expense report under conditions evaluated by the app).
 The app is not acting on behalf of any user (for example, the call is being made by the app alone, not by
a user who is using the app).
App permissions in SharePoint 2013
i. Introduction:
An app has the following basic information:
 Client Id.
 Display name.
 The app domain.
ii. Types of app permissions and app permission request scopes:
 The permission requests specify both the rights that an app needs and the scope at which it
needs the rights.
 Types of app permisson:
 Permission request scopes indicate the location in the SharePoint hierarchy where a permission
request applies.
 SharePoint 2013 supports scopes within the content database and tenancy:
1) site collection
2) website
3) list
4) Tenancy
 If an app is granted permission to one of the scopes, the permission applies to all children of the
scope.
 Because permission requests are made without information about the topology of the site
collection where the app is installed, the scope is expressed as a type instead of as the URL
iii. Understanding differences between app permission rights and user rights
Chapter 2—8 of 82
App can have the following rights:
a) Read: Enables apps to view pages, list items, and download documents.
b) Write: view, add, update, and delete items in existing lists and document libraries.
c) Manage:view, add, update, delete, approve, and customize items or pages within a web site.
d) FullControl:Enables apps to have full control within the specified scope.
e) Query right For Search only.
 These rights correspond to the default user permission levels: Reader, Contributor, Designer, and Full
Control.
 Unlike SharePoint user roles, these rights levels are not customizable.
 App rights names do not match the corresponding SharePoint user roles, except Full Control, which
can't be customized through the permissions management user interface.
 Permissions that are not known to SharePoint 2013 are ignored.
iv. Permission request scopes, available rights, and Office Store apps rights
Different scopes have different sets of rights that are available for an app to request:
I. Office Store apps: Only Read, Write, and Manage rights are allowed no full control.
II. site collection website list: Read, Write, Manage and full control.
III. other SharePoint features:
 BCS Read.
 Search QueryAsUserIgnoreAppPrincipal.
 Project Server Read, Write, Manage , SubmitStatus and Elevate.
 Social features Read, Write, Manage and full control.
 Taxonomy app Read and Write.
Apps that request more than Manage permissions can still be deployed through the app catalog
as it is blocked through “office store”.
v. Managing app permissions
 The SharePoint 2013 implementation of the OAuth protocol, end users have four different
opportunities to manage app permissions:
1) During app installation
2) By using explicit permissions management
3) By using an end-user consent UI
4) During app removal
vi. Next steps
 How to: Create a basic provider-hosted app for SharePoint
 Tips and FAQ: OAuth and remote apps for SharePoint
 OAuth authentication and authorization flow for cloud-hosted apps in SharePoint 2013
Plan app permissions management in SharePoint 2013
App permissions management manage the ability of apps to access and use internal
SharePoint 2013 resources and perform tasks on behalf of users.
Introduction
To plan the management of app permissions you have to:
a) Determine the specific SharePoint 2013 resources that the app will need to access, and where those
resources reside.
b) Determine the minimum permission level that will be required to enable the app to function correctly.
c) Determine the appropriate app authorization policy to ensure that the app functions correctly and
complies with specified authorization requirements.
d) Determine who will be installing the apps and who will be using them.
App permission request scopes
 Specify the level at which the app is intended to run, and the permission level that is assigned to the
app.
 Permission request scopes:
1) SPSite Defines the app permission request scope as a SharePoint 2013 site collection.
Chapter 2—9 of 82
2) SPWeb web site.
3) SPList list.
4) Tenancy Tenancy
 App permission requests are collections of permissions that enable apps to perform specific
tasks. For example Read (View Items, Open Items, View Versions, Create Alerts, View Pages).
specify permissions for Office Store apps,
Only Read, Write, and Manage rights are allowed for Office Store apps
specify permissions for Corporate Catalog Apps, specify permissions for remote apps to access
SharePoint data
????????????
1.3. Build apps for SharePoint
 What is an app for SharePoint in SharePoint 2013?
 Is a solution that carries a light footprint and uses standards-based technologies such as HTML5,
JavaScript, and Oauth, to extend the capabilities of a SharePoint website.
 light footprint because they don't actually install on the host server, and that means they don't
overload a SharePoint site with excessive API calls.
Why build apps for SharePoint?
a) A familiar programming model, plus popular technologies and languages
For apps, the web is the platform. If you can build a web application, you can build an app for SharePoint,
Use any language [HTML, JavaScript, PHP, or .NET] - and your favorite web development tools [Visual
Studio 2012 or the new "Napa" Office 365].
Have a similar development process for any device you are targeting – mobile phones, tablets, or
computers – so you can be more efficient and productive.
Separate the app’s logic data[sql,mysql,..]and user interface (UI)[JS,ASP.net,..] to fit your needs.
Use the expanded capabilities of REST and client APIs (JavaScript and .NET) to access the rich data
and services in SharePoint such as search, workflow, social networking, taxonomy, user profiles, and
Business Connectivity Services (BCS).
Use the new OAuth 2.0 support in SharePoint.
b) Multiple options for hosting
1. SharePoint-hosted apps
 Apps where all components are hosted on either an on-premises or Office 365
SharePoint farm.
 Installed on a SharePoint 2013 website, called the host web. They have their resources
hosted on an isolated subsite of a host web, called the app web.
 Deployed to app webs, rather than the host web for Two Reasons:
a) Enforcement of app permissions: App has it’s permissions that are not
necessarily the same as the permissions of the user who is executing the app.
b) Cross-domain scripting security: Ensure that JavaScript in the app for
SharePoint cannot execute any JavaScript from any other domain.
 You can combine a SharePoint-hosted app with apps that have remotely hosted
components, but any app or portion of an app that runs on an app web has the following
set of requirements for three key components:
a) where the app is hosted.
b) How the app gets authorization.
c) What language it can use.
 Advantaged “Benifits” of SharePoint-hosted apps?
1. Reuse common SharePoint items, like lists and Web Parts, BUT Only JavaScript no server side code
Chapter 2—10 of 82
2. Easy to create and deploy, so they are good for small team productivity apps and business process
automation, with lower complexity business rules, BUT Your app has only the authorization privileges of
the signed-in user.
3. Learn how to create a basic SharePoint-hosted app.
2. Provider-hosted apps
 Include components that are deployed and hosted outside the SharePoint farm. They are installed to the host
web, but their remote components are hosted on another server.
 A provider-hosted app interacts with a SharePoint site but also uses resources and services that are
located on the remote site.
 Requirements three key components:
a) where the app is hosted. Any web server or hosting service.
b) How the app gets authorization. OAuth or the JavaScript cross-domain library.
c) What language it can use. Any language supported by your web server or hosting service.
Get these benefits But consider this
 Host the app on Microsoft Azure or any remote
web platform,
including non-Microsoft platforms.
 You are responsible for creating the installation,upgrade
and uninstallation logic of the remote components.
 Use one of the SharePoint client object models,
the JavaScript cross-domain library,
or REST/OData-based web service to interact with
SharePoint.
 Each way of interacting with SharePoint has corresponding
options for approaches to data access.
 Gain authorization to SharePoint data using
either
OAuth or the JavaScript cross-domain library.
 You need to decide between OAuth and the cross-domain
library to authorize your app’s access to SharePoint.

3. AutoHosted Apps
J
c) A familiar web experience, yet more flexible
Apps for SharePoint have the same user experience as SharePoint websites but are more:
1) As an immersive full-page experience
2) As part of a webpage, using app parts to surface an iframe element that contains the app
3) As UI custom actions, extending ribbons and menus by adding the app to list items, documents, and more
d) Integrates with apps for Office
Use the Office Store to sell your app for SharePoint
e) Lets you reach users through the Office Store and the App Catalog
 Use the Office Store to sell your app for SharePoint to users
 Apps for a company are deployed to the organization's internal App Catalog hosted on SharePoint,
Chapter 2—11 of 82
 Start developing apps for SharePoint
Building an app for SharePoint
 To build your app for SharePoint, you must do the following:
1) Configuring an app
 An app for SharePoint is configured with SharePoint using an app manifest—an XML file that declares the
app’s basic properties, where it runs, and what to do when it starts.
An app manifest file can do many things:
A. Use different authentication schemes (app principals) and declare the permissions the app needs.
B. Can also include tokens that are replaced at build/run time, so you can reference your app and pass context (for
example, the SharePoint language and where the app is installed)
C. Tells SharePoint to register the app and invoke a remote page when the app starts.
2) Deciding where the app’s code runs (hosting options)
 Host in SharePoint, in the cloud, or a mix of SharePoint and cloud.
1. Provider-hosted apps: You must host a provider-hosted app on a dedicated server or third-party
hosting service. Depending on your choice, these apps run either on your server or in the cloud.
2. SharePoint-hosted apps: When the app is hosted in SharePoint itself, the code is only in HTML
and JavaScript and is hosted by SharePoint.
3. Hybrid apps (components in both SharePoint and the cloud): In these apps, SharePoint
components run in SharePoint while components hosted in the cloud run in the cloud.
3) Communicating with SharePoint using SharePoint APIs
 Apps show their power when they use SharePoint APIs to connect and integrate with SharePoint features—
search, workflow, social networking, taxonomy, user profiles, BCS, and more. This lets them read
documents, do searches, connect people, and much more.
SharePoint APIs include the following:
i. REST APIs and JavaScript APIs
ii. Managed APIs (.NET)
4) Packaging and distributing an app
Apps for SharePoint are distributed as an app package, and the components it contains depend on where your
app is hosted.:
a. A provider-hosted app package might contain only the app manifest if the app is hosted on a
dedicated server or third-party hosting service.
b. A SharePoint-hosted app package might contain some SharePoint-related components and the app
manifest.,App packages can include components such as apps for Office.
Plan and implement user authorization
Chapter 3—1 of 10
Chapter 3 Access and manage data (10‒15%)
Design solutions to handle large amounts of data
Create efficient CAML (Collaborative Application Markup Language )queries and views
Query Schema:
The Query schema of (CAML) is used in various ways within the context of Microsoft SharePoint Foundation to define
queries against list data.
Assign CAML query strings to :
i. Query property of several classes in the server and client object models in order to return data, or
ii. Method parameters of the Lists web service to work remotely with data.
iii. Context of CAML views to return specific data.
View Schema:
 The View schema of (CAML) is used to define how the contents of a list view are rendered in Microsoft SharePoint
Foundation.
 SharePoint Foundation uses XSLT to define list views(includes a query that returns the data that is displayed in
view)
 Views can be created or modified programmatically through either the server-side or client-side object model.
 Specialized rendering elements are used within a view to define the logic for constructing HTML.
Handling Large Folders and Lists: When the size of folders and lists increases, you must optimize performance.
 You should concern :
1. Query throttling, which can cause code to change in unexpected and unpredictable ways over time as your site
evolves and your queries begin to return items that exceed the query threshold.
2. Efficient retrieval of items from large folders and lists.
 To view and increase this threshold or to enable the object model to override the threshold
 On the Central Administration site, under Application Management, click Manage Web
Applications.
 Click General Settings, and then click Resource Throttling.
 View and update the threshold or allow the object model to override the limit.
 When you are working with folders and lists:
 Do not use SPList.Items.
 SPList.Items selects all items from all subfolders, including all fields in the list. Use the following alternatives for
each use case:
 Adding an item:
 Instead of calling SPList.Items.Add, use SPList.AddItem.
 Retrieving all items in a list:
 Instead of using SPList.Items, use SPList.GetItems(SPQuery query) .
 Apply filters, if appropriate, and specify only the fields you need to make the query more efficient.
 Getting items by identifier
 Instead of using SPList.Items.GetItemById, use SPList.GetItemById(int id, string field1, params
string[] fields). Specify the item identifier and the field that you want.
 Do not enumerate entire SPList.Items collections or SPFolder.Files collections.
 Table 1. Alternatives to enumerate SPList.Items
Poor Performing Methods Better Performing Alternatives
SPList.Items.Count SPList.ItemCount
SPList.Items.GetItemById(System.Int32) SPList.GetItemById(System.Int32)
 When you delete multiple versions of a list item, use the DeleteByID() method; do not use the Delete() method.
Choose appropriate APIs
Chapter 3—2 of 10
 Types of APIs including:
1) Server object model.
2) Various client object models.[ JavaScript, .NET Framework, Mobile, .. ]
3) REST/OData web service.
 Factors that determine which API set to use
a) The type of application:
A. an app for SharePoint.
B. Web Part on a SharePoint page.
C. JavaScript running in a SharePoint site page.
D. Application page.......
b) Your existing skills:Using any of the following programming models:
1. JavaScript
2. ASP.NET
3. REST/OData
4. .NET Framework
5. Windows Phone
6. Windows PowerShell
c) The device on which the code runs:
a) Server in the SharePoint farm.
b) External server such as a server in the cloud.
c) Client computer.
d) Mobile device.
If you want to do this ... ... use these APIs
 Create an HTML/JavaScript application that performs CRUD operations on SharePoint
data or
 Create an app for Office that works with SharePoint
JavaScript client
object model
 Create a custom Web Part, application page, or ASP.NET user control or
 Create a timer job
Server object model
 Create a LAMP web application that performs CRUD operations on SharePoint data or
external data that is surfaced in SharePoint by a BCS external content type or
 Create an iOS or Android app that performs CRUD operations on SharePoint data
REST/OData
endpoints
 Server object model
The largest set of APIs is in the server object model of managed classes.
classes are added SP2013 to enable programming of:
 Enterprise Content Management (ECM).
 User profiles.
 Taxonomy.
 Advanced search.
Limitations of server object model:
You cannot use the server object model in an app for SharePoint,
 Client object models:
Client object models in SharePoint 2013:
1) .NET: Are sent to the SharePoint server in batches where they are converted to server-side code and
executed.
Developer determine whether a batch runs Synchronously or Asynchronously.
 Synchronous batch: the .NET Framework application waits for the returned results from the server .
 Asynchronous batch: client-side processing continues immediately and the client (UI) remains responsive.
2) Silverlight: Silverlight .xap files can be included in apps for SharePoint, including SharePoint-hosted apps.
3) Mobile.
 JavaScript object model
 Use in either inline script or separate .js files.
 It includes all the same functionality as the Silverlight client object models. and .NET Framework .
Chapter 3—3 of 10
 In addition, it is now possible to access SharePoint data across domains in JavaScript (but only data that is
within the same parent site collection), which was not allowed in previous versions of SharePoint. Data is
returned from the server in JavaScript Object Notation (JSON).
 The JavaScript object model is defined in a set of *.js files located at 15TEMPLATELAYOUTS on each server.
 REST/OData endpoints
 Representational State Transfer (REST) web service that uses the OData protocol to perform CRUD operations
on SharePoint list data.
 Used when you need to access SharePoint entities from client technologies that do not use JavaScript and are
not built on the .NET Framework or Silverlight platforms
 To use the REST capabilities, your code constructs a RESTful HTTP request to an endpoint that corresponds
to the desired client object model API.
 The client.svc web service handles the HTTP request and serves a response in either Atom or JSON format.
 almost every API in the client object models has a corresponding REST endpoint. This enables your code to
interact directly with SharePoint artifacts by using any technology that supports standard HTTP requests and
responses.
 Comparing REST/OData programming with client object model programming
Feature .NET Framework or
Silverlight object
models
JavaScript
object
model
REST/OData endpoints
called from a Windows
platform or JavaScript
Object-oriented programming Yes Yes No
Batch processing Yes Yes No
APIs for conditional processing and exception
handling
Yes No No
Availability of LINQ syntax Yes No No
Combining list data from different SharePoint web
applications
Yes No Yes
Familiarity to experienced REST/OData developers No No Yes
Similarity to non-Windows programming or
JavaScript programming
No Yes Yes
Strong typing for list item fields No (except with
LINQ)
No Yes, from Windows platform
No, from JavaScript
Leveraging jQuery, Knockout, and other JavaScript
libraries
No Yes No, from Windows platform
Yes, from JavaScript
 WCF Data Services Framework
 If you prefer to use LINQ syntax in .NET Framework or Silverlight client applications, SharePoint 2013 supports
WCF Data Services as a LINQ provider.
 You can target either the listdata.svc (for list data only), or you can target the same client.svc that supports
the OData interface for access to all SharePoint entities in addition to list data.

 Deprecated API sets
1. ASP.NET (asmx) web services.
2. Direct Remote Procedure Calls (RPC) calls to the owssvr.dll file.
Chapter 3—4 of 10
Create and use indexed columns
Enforcing Uniqueness in Column Values by two ways:
a. Primary key identity (ID).
b. Unique column constraints feature.
Defining "Unique"
 SharePoint Foundation evaluates column values and determines uniqueness based on its evaluation of the values
present in the column. For the evaluation, SharePoint Foundation uses the sort order of the site (the SPWeb) to
do uniqueness case-insensitive comparisons.
Supporting Unique Column Constraints
 The key factor in determining whether a column supports uniqueness constraints is whether that column can be
indexed.
 Furthermore, when uniqueness is enforced on a Lookup column, uniqueness is not enforced on the projected
column of the target list but rather on the ID column.
 Column types that support the ability to be indexed ...> Unique:
 Single line of text.
 Choice field (but not multichoice).
 Number.
 Currency.
 Column types that dont support the ability to be indexed:
 Multiple lines of text.
 Hyperlink/Picture.
 Custom Field Types.
 Calculated Field.
 Boolean (yes/no).
 Modified by.
Indexing a Column with Unique Constraints
 After a column has been set to enforce uniqueness, indexing cannot be turned off for that column. However, you
can turn off indexing for that column if you first disable enforcement of uniqueness constraints.
Setting Unique Constraints Programmatically
 public bool EnforceUniqueValues { get; set; }
//Gets or sets a Boolean value that specifies whether to enforce uniqueness in column values. The default is false.
 You cannot set this property to true for a built-in field or for a site column.
 When you set this property to true, you should Firstly set the Indexed property to true.
Error Causes – Exceptions:
1) EnforceUniqueValues = true is set on a non-indexed field.
Message reading "The field must first be indexed to enforce unique values."
2) EnforceUniqueValues = true is set on a list that has existing duplicate values.
Message reading "This field contains duplicate values. Remove all duplicate values and try the operation
again”.
Content Migration and Unique Column Constraints
 Content migration by using APIs support all types:
i. partial (selective) migrations:
 Merge files from the source site collection with files on the target
 Automatically account for uniqueness states
ii. full site collection migrations. by using export/import functions
 you must ensure that if the uniqueness property is set on the list field on the export source, then the
setting must be persisted on the import target.
Copy-To and Move-To Operations with Column Constraints
 Special considerations come into play whenever you copy or move items to a document library that is enforcing
unique column constraints and you use the CopyTo(String)and MoveTo(String) methods on the SPFile class
Chapter 3—5 of 10
Copy To operation Move To operation
Within Same Doc
Library
Checks for uniqueness violations at the document
level.
Does not check across library folders.
Moves without checking.
Across Doc
Libraries
Converts values to null. Blocks the move if the destination list has
enforced unique values.
Out of Doc Library No effect. No effect.
Into Doc Library Convert values to null. Convert values to null.
Use Object Model Overrides
SPQuery.QueryThrottleMode property
 //Gets or sets a value that indicates the throttling mode to be applied to the query.
 public SPQueryThrottleOption QueryThrottleMode { get; set; }
 Throttling is applied based on user role and permissions.
SPWebApplication.AllowOMCodeOverrideThrottleSettings property
 //Indicates whether custom object model code can override the throttle settings.
 public bool AllowOMCodeOverrideThrottleSettings { get; set; }
 true if custom code can override throttle settings; otherwise, false.
 SecurityException: The current user is not a farm administrator.
SPList.EnableThrottling property // is bad
 //Indicates whether throttling for this list is enabled or not.
 public bool EnableThrottling { get; set; }
 A Boolean indicating throttling status. A value of true throttling is enabled while false indicates otherwise.
 Farm admin can set it to FALSE to make this list exception for throttle feature if it is set to false, then this list will
not be throttled.
Use Content Iterator
 Writing Efficient Code in SharePoint Server
 how to make the SharePoint object model work efficiently (performance, extensibility, and scalability)
 Using SPQuery Objects:
 Well-designed queries can help you avoid performance problems that can occur over time as the size of your
site's lists and folders increases.
1) Use a bounded SPQuery object:
 Specify a RowLimit between 1 and 2000 and page through the list if necessary.
2) Limit the result set:
 Set the query threshold to limit the result default is 5,000 items,
3) Use indexed fields:
 SetSPQuery.RowLimit to a value that is less than or equal to the threshold value.
4) Ensure you include one of the three OrderBy:
 OrderByID, OrderByPath, or OrderByNVPField.
 Used whenever the query is not designed to be restrictive enough to return fewer than the maximum
number of items using previous techniques .
 Using PortalSiteMapProvider:
 PortalSiteMapProvider provides an automatic caching infrastructure for retrieving list data. The
GetCachedListItemsByQuery method of PortalSiteMapProvider takes an SPQuery object as a parameter, and
then checks its cache to determine whether the items already exist. If they do, the method returns the cached
results. If not, it queries the list and stores the results in a cache.
Chapter 3—6 of 10
 This approach works especially well when you are retrieving list data that does not change significantly over
time.
 Limitation of PortalSiteMapProvider:
a) Collection object cache that store data has a default size of 100 MB. You can increase the size of this cache
for each site collection on the object cache settings page for the site collection. This memory, however, is
taken from the shared memory available to the application pool and can therefore affect the performance
of other applications.
b) Cannot use it in applications based on Windows Forms.
Implement cross-site queries
SPSiteDataQuery class
Represents a query that can be performed across multiple lists in multiple Web sites in the same Web site Collection
public sealed class SPSiteDataQuery
Specify the scope of the query by setting the Webs property. Specify the lists to participate in the query by setting
the Lists property and the fields to return by setting the ViewFields property. Control data selection and order by
setting the Query property in the same Collection.
pass the SPSiteDataQuery object to the GetSiteData(SPSiteDataQuery) method, which returns a DataTable object
containing rows of data that represent the result of the query.
Access data contained in SharePoint
Access data using server-side object model
 Working with List Objects and Collections:
 Objects
 Collections [ count, add, delete]
 Indexers
Access data using client-side object model (CSOM)
Data Retrieval Overview
 You can use the new client object model to retrieve properties for a specific SharePoint client object, or to retrieve
child items in a collection. The client object models do not persist data that is retrieved locally on the client.
Performing data retrieval involves the following procedure:
1. Return the context for a client request by using the (JavaScript: ClientContext(serverRelativeUrl)).
2. Use the object model to specify an object to retrieve or from which to retrieve data.
3. Load the object or collection:
a) load(clientObject)) :
 In-place load.
 Object identity is retained.
 ClientContext.Load(clientContext.Web.Lists);
b) loadQuery(clientObjectCollection, exp)
 Queryable load.
 Query is separate from the returned results.
 Two steps defining the query expression, retrieving the query result.
 Object identity is not retained, so your code must itself maintain.
 var query = from list in clientContext.Web.Lists select list;
 var result = clientContext.LoadQuery(query);
4. Execute the query by calling the:
i. ExecuteQuery() method in the .NET or Silverlight version. ........> SYNC
ii. ExecuteQueryAsync(SucceededEventHandler, RequestFailedEventHandler) .....> ASYNC In the JS.
5. When the method call to execute the query returns (either synchronously or asynchronously), you can access the
results of the query on the object from which you initiated the query.
Chapter 3—7 of 10
Query syntax versus method syntax
 Both forms of Language-Integrated Query (LINQ) syntax--query syntax and method syntax [lambda expressions].
 Three points to keep in mind when using LINQ to query against the client object model:
1) you are using LINQ to Objects, not the LINQ to SharePoint provider.
2) When your query is designed to return a subset of items from a list, it is more efficient to use a CAML query
than a LINQ query. This is because With a CAML query, the filtering is done on the database server.
3) Returning a subset of the lists from a web site, LINQ are more efficient.
Using query strings in ECMAScript
 The JavaScript methods for retrieving objects and data do not accept LINQ syntax, but you can use a string
expression to define a basic query.
 Ex: clientContext.load(collList, 'Include(Title, Id)');
How to retrieve objects
When list object is loaded in place, all default properties of the list can be accessed.
How to update objects
 Both Client object model and Server object model modification require calling update() method however,
 Client object model, changes do not take effect until the object is loaded and ExecuteQuery() or
ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler)
How to retrieve list items
 it's most efficient to use a query in CAML use this method GetItems(CamlQuery) method
How to update list items
 To modify a list item you can specify the column value to change through an indexer, and just as for other objects,
call Update() (JavaScript: update()) before calling ExecuteQuery() or ExecuteQueryAsync(Sucess,Failure).
 ListItem oItem = oList.GetItemById(5);
Asynchronous Processing
Both the JavaScript version of the object model and the Silverlight version:
 Asynchronous processing when it modifies the (UI).
 Current() property when Specify the current request context.
Access data using out-of-the-box Web Services
 The Web services include methods for accessing content on a Web site [lists or document workspaces, or search].
 Whenever possible, it is recommended that you use the new client-side object model to work remotely with
SharePoint Foundation data, instead of using the legacy ASP.NET Web services.
 SharePoint Foundation does not require the implementation of a particular version of SOAP. The SOAP response in
any transaction with SharePoint Foundation is managed by the .NET Framework.
Access data using REST API
 Use OData query string operations to select, filter, and order the data you request from the SharePoint REST service.:
 Select fields to return
 Use the $select query option to specify which fields to return for a given list, list item, or other SharePoint object
represented by an entity set. You can use $select=* to return all available fields.
 If you do not specify the $select query option, the REST service returns all available fields by default.
 Request can returns projected fields from other lists and the values of lookups. To do this, specify the field name in
both the $select and $expand query options. For example:
http://server/site/_api/web/lists('guid')/items?$select=Title,Products/Name&$expand=Products/Name
 Bulk expansion and selection of related items is not supported.
 Select items to return
 Use the $filter query option to select which items to return. OData query operators supported in the SharePoint
REST service lists the filter query comparison options and functions you can use with the SharePoint REST service.
 Query for single value lookup fields
Chapter 3—8 of 10
 Single value lookup fields are represented by two separate fields in the SharePoint REST service: one field
representing the actual field value, and another representing the field name.
 queries against the lookup field value as you would any other fields
 Query for users
 In the SharePoint REST service, users are represented by the user's friendly (display) name so construct user
queries against users' friendly names.
 Membership-based user queries are not supported.
 Usage of the Current operator to do queries using the ID of the current user is not supported.
 Query for multi-value lookup fields and users
 Because multi-value lookup fields are returned as a string of multiple values, there is no way to query for them (for
example, the equivalent of an Includes element or NotIncludes element is not supported).
 Sort returned items
 Use the $orderby query option to specify how to sort the items in your query return set.
 To sort by multiple fields, specify a comma-separated list of fields.
 Ascending or descending order by appending the asc or desc keyword to your query.
 Page through returned items
 Use the $top and $skip query options to select a subset of the items that would otherwise be returned by your
query.
 The $top option enables you to select the first n items of the return set for return
 http://server/site/_api/web/lists('<guid>')/items$top=10
 The $skip option enables you to skip over the specified number of items and return the rest.
 When using these query options, take into account that paging in OData is ordinal.
 OData query operators supported in the SharePoint REST service
Chapter 3—9 of 10
Access data using a custom (WCF) service to facilitate integration with an existing application:
 You can create a custom web service that uses the server object model to access data.Gfg
 SharePoint supports creation of both Microsoft ASP.NET and WCF custom web services, which can be used to
develop SOAP-style or RESTful web services.
 Although an ASP.NET web service has simpler configuration requirements, a WCF service provides more flexible,
powerful bindings that are important for advanced applications.
 A WCF web service can be more complicated, because its architecture requires you to specify complete
configuration of the WCF service endpoints. This configuration information includes endpoint addresses, a service
contract, and a binding configuration
 Because this kind of configuration information cannot be provided in a static form, a web.config type of
configuration cannot be used. The solution is dynamic configuration, or in WCF terms, programmatic
configuration.
 At run time, the SharePoint Foundation service factory configures the appropriate endpoints for your service
automatically.
 Creating and Implementing a Custom WCF Service:
Chapter 3—10 of 10
 Important When a web application is configured to use claims authentication, the (IIS) website is always
configured to have anonymous access turned on. Your custom SOAP and WCF endpoints may receive requests
from anonymous users If you have code in your WCF service that calls the RunWithElevatedPrivileges method.
Store configuration data
Implement web.config:
 use the SPWebConfigModification class which allows you to dynamically register entities, The changes become
effective when theSPWebService.ApplyWebConfigModifications method is called.
o SPWebService service = SPWebService.ContentService;
o SPWebConfigModification myModification = new SPWebConfigModification();
o myModification.Path ,name, sequence, type, value
o service.WebConfigModifications.Add(myModification);
o service.Update();
o service.ApplyWebConfigModifications();
 Removing Configuration Settings:
 modsCollection.Remove(configModFound);
Implement a hierarchical data store &implement a property bag, implement SharePoint List:
Managing Application Configuration:
Configuration data is data that controls the program's logic instead of data that controls the business or user
logic. An example of configuration data is a :
 Connection string to a database
 Storage options that SharePoint provides for other types of data
Property Bag Schema:
 An elements manifest can define a property bag for a file, folder, list item, or website.
 The following is a list of the elements in the Property Bag schema.
 <Elements>
 <PropertyBag>
 <Property>
Implement credential storage:
Chapter 4—1 of 10
Chapter 4 Implement SharePoint solutions (15‒20%)
Manage SharePoint Object Life Cycle
Implement Object Life Cycle management for SP Objects [SPWeb, ,SPSite]:
 Best Practices: Using Disposable Windows SharePoint Services Objects to avoid retaining the objects in
memory in the Microsoft .NET Framework.
 Introduction :
o Why Dispose?
 Several of the Windows SharePoint Services objects, primarily the SPSite class and SPWeb class
are lage in memory and make pressure on the garbage collector, which does not release the
object from memory in a timely manner, so
 You should not rely on the garbage collector to release them from memory automatically.
 Finding Incorrectly Disposed Objects:
 To identify the code that causes the problem, you can search in the logs for entries that contain the
allocation identifiers
 Coding Techniques to Ensure Object Disposal:
a) Dispose method.
b) using clause.
c) try, catch, and finally blocks.
 SPSite Objects
 You should dispose of any SPSite object returned from the SPSiteCollection.Add method.
 SPWeb Objects
o The dispose cleanup is handled automatically by the SharePoint framework.
 Other Objects That Require Disposal
 Use SharePoint Dispose Checker Tool.
Implement Object Life Cycle management for SPContext:
 You don’t need to dispose objects coming from the SPContext but if you create child objectfrom it
dispose the child object ex: SPContext.Current.Site.OpenWeb().Dispose()
Implement Object Life Cycle management with Windows PowerShell:
o Start-SPAssignment –global
o $w = Get-SPWeb http://MyWeb
o $w | Set-SPWeb –title "Accounting"Stop-SPAssignment –global
o $gc = Start-SPAssignment
o $web = $gc | Get-SPWeb http://MyWeb
o $web | Set-SPWeb –title "Accounting"Stop-SPAssignment –Identity $gc
Upgrade solutions and features
Implement versioning of features and solutions
 Every Feature has a version number that is specified in the corresponding Feature.xml file.
 when you deploy a new version of a Feature, SharePoint Foundation detects that the associated Feature
instance also needs an upgrade because the instance version number is lower than the new version
number specified in the current Feature.xml file.
 We can make use of Version attribute on the Feature element in SharePoint
Upgrade features and solutions
Chapter 4—2 of 10
 SHAREPOINT 2010 FARM SOLUTIONS WILL RUN ON 2013
If you take a SharePoint 2010 farm solution (as a WSP) and install it into 2013
 Upgrade Steps:
a) SUPPORT MULTIPLE VERSIONS IN ONE VISUAL STUDIO SOLUTION
b) CHANGE THE VERSION OF YOUR SOLUTION PACKAGE TO '15.0'
c) WHO MOVED THE GAC?
d) SPUTILITY.GETGENERICSETUPPATH METHOD IS OBSOLETE
e) THE _LAYOUTS VIRTUAL DIRECTORY NOW HAS A SNEAKY "15" IN IT
 Upgrading Features:
Microsoft SharePoint Foundation provides new members that make it possible for you to upgrade custom
Features through versioning and declarative upgrade actions:
I. Define upgrade definitions for new Feature versions.
II. Provision a list instance as part of a Feature upgrade.
III. Create separate upgrade action sets, based on the Feature version, that remove different sets of files.
IV. Apply settings to site collections where a particular Feature is activated.
 SPSite, SPWebApplication, SPWebService [.QueryFeatures(myScope, true)]
 Feature.xml Changes
 The new <UpgradeActions> section in a Feature.xml file specifies upgrade actions that you can apply to a
specified Feature.
 The <UpgradeActions> element can contain the following sub-elements:
 <CustomUpgradeAction> — Allows you to execute custom code when a Feature instance is being
upgraded. When an action is specified in an upgrade action sequence, Microsoft SharePoint Foundation
calls the FeatureUpgrading(SPFeatureReceiverProperties, String, IDictionary<String, String>) method
synchronously with other upgrade actions, in order of declaration.
 <VersionRange> — Specifies a version range to which specified upgrade actions apply.
 <ApplyElementManifests> — Adds a new element to an existing Feature. When a Feature is upgraded,
provisions all non-declarative elements that are referenced in the specified element manifests.
 <AddContentTypeField> — Adds a new field to an existing provisioned content type. Propagates the
change from the site content type to all child lists and content types within the site.
 Upgrading a Farm Solution in SharePoint
There are two ways to upgrade a farm solution:
Replacement: The old version of the solution is retracted, and optionally removed from the farm solution
store. The new version is then added to the solution store and deployed. It is not necessary that the new
solution package (.wsp file) have the same name or GUID as the old version, however, if the old version is
retracted but not removed from the solution store, then the new version must have a different filename and
GUID. This kind of upgrade must be used if the new version of the solution differs from the installed version
in any of the following ways The new version:
a) Removes a Feature that was in the old version or adds a Feature that was not in the old version.
b) Changes the ID of a Feature.
c) Changes the scope of a Feature.
d) Changed version of a Feature Receiver.
e) Adds a new elements.xml file, removes an elements.xml file, or changes the contents of an existing
elements.xml file.
f) Adds a new Property element to a Feature.xml file, removes a Property element from a Feature.xml file or
changes the value of a Property element in a Feature.xml file.
Update:
 A new version of the solution package is installed and deployed which has a different file name but
the same GUID as the old version.
 the GUIDs are the same, SP automatically retracts the old version before deploying the new version.
Chapter 4—3 of 10
 If there are Features in the solution, then the new and old versions have the same set of Features and
they remain activated but assemblies and certain other files in them are updated with the versions
from the new solution package.
 Each time a solution is successfully upgraded, the previous version of the solution is backed up and
stored in the configuration store.
 This backup is used by the solution framework in the case of an upgrade failure. Only a single backup
copy is stored per solution.
 Farm administrators perform an update type of upgrade with the Update-SPSolution command in
SharePoint Management Shell.
Implement assembly versioning & Build components for in-process request routing
 One of the nice features of Sharepoint 2010 is the automatic assemblies redirect which allows to use old
code which was written and compiled for Sharepoint 2007 also in Sharepoint 2010. It is achieved by
assemblies redirects in web.config.
Determine a solution structure
Select feature scope and visibility.
Elements by Scope
Define feature dependencies.
 Activation Dependencies and Scope:
Expresses a requirement in the relationship between two Features. when a Feature at a particular scope has a
dependency on another Feature .
Why using activation dependencies??
a) Feature grouping concepts: When one Feature is activated, other Features can also be activated or When
you deactivate the Feature, the dependent Features are deactivated if no other Features depend on them.
b) Feature resource guarantees: You may need Web site-scoped Feature to contain an implementation. You
can use an activation dependency to ensure that both Features are activated.
Activation Dependency Rules:
 Activation dependencies must applied by certain rules to avoid, Circular dependencies, dependency chains
that limit performance.
1. Same-Scope Rules:
 If a Feature is dependent on another Feature at the same scope, and the second Feature is not
activated when the first one is activated, Microsoft SharePoint Foundation activates the second
Feature.
 If a Feature is deactivated, SharePoint Foundation deactivates a same-scope dependent hidden
Feature when the last visible Feature that dependet on that hidden Feature is deactivated.
2. Cross-Scope Rules:
 Cross-scope activation dependencies are not supported if the Feature depended upon:
i. is at a more restrictive scope. Ex: a site collection–scoped Feature, Web site–scoped Feature.
ii. is not visible in the user interface.
iii. is not activated, activation of the depending Feature fails.
3. General Rules:
 Dependencies can work only one level deep. In other words, dependency chains are not supported.
does support more than one level in activation dependencies.
 You can target an activation dependency against hidden or visible Features, but hidden Features
cannot have activation dependencies.
Chapter 4—4 of 10
 When more than one Feature has a dependency on a given Feature, keep in mind the danger of
leaving one of the depending Features without the required Feature dependencies. For example,
B=>A A=>C .. deactiv B=> deactiv A but C is still activated
<ActivationDependencies>
<ActivationDependency
FeatureId="11111111-1111-1111-1111-111111111111" />
</ActivationDependencies>
Define solution dependencies.
When you deploy a solution with an activation dependency, SharePoint will check if this parent solution is
already deployed. If not, you will get an error message.
Solution dependencies must be defined in the solution manifest, i.e. the manifest.xml file in your wsp
package.
Organize SharePoint project items.
Packaging and Deploying SharePoint Solutions:
 Creating Features and Packages:
I. Visual Studio
II. SharePoint solution package (.wsp) to bundle multiple features, site definitions and assemblies.
 Feature and Packaging Tool Support:
A. Feature Designer and Package Designer.
B. Packaging Explorer, a tool window.
C. Solution Explorer.
 Deploying SharePoint Solutions:
After you customize the Features and package in Visual Studio, you can create a .wsp file to deploy to
SharePoint servers. You can use Visual Studio to debug and test the .wsp only on the SharePoint server on
the development computer.
Deploying Files in SharePoint Solutions:
For example, to add an no compiled file (.xml file) to a SharePoint project:
1) Add a SharePoint "Layouts" Mapped Folder to your project. Add the .xml file to the new subfolder. By
default, the file is deployed to the SharePoint file system under ..TEMPLATELAYOUTSFolder Name.
2) Add the .xml file to the folder of a SharePoint project item, and then change the Deployment Type
property of the .xml file from NoDeployment to another setting such as RootFile or ElementFile.
3) If an added file does not apply to any specific project in the solution, you can add an Empty SharePoint
Project to your solution and then add the additional files to it. Another alternative for deploying files to
SharePoint, especially to the content database, is to add a module to the project and then add the files
to the module.
Create sandbox solutions
Scope features to constraint
Only Features scoped to the site collection or the website are possible in sandboxed solutions.Farm and web
application scope are not possible. Site collection features are activatedautomatically when the solution
activated
Restrictions on Sandboxed Solutions:
a) Triple Worker Processes.
b) Low-Privileged Security Token for the Sandboxed Worker Process.
c) Restrictive Code Access Security Policy for the Sandboxed Worker Process.
d) Special Versions of the Microsoft.SharePoint.dll Assembly.
Chapter 4—5 of 10
e) Split Page Rendering System.
f) Resource Usage Limitations.
g) Farm-Relative Validation of Solutions.
h) Farm-Relative Blocking of Solutions.
i) Farm-Relative Blocking of Classes.
Identify SharePoint artifacts that can be used in sandbox:
What Can Be Implemented in Sandboxed Solutions:
I. Assembly
Refers to assemblies whose source code is part of the Microsoft Visual Studio sandboxed solution project.
Non-SharePoint assemblies cannot be deployed in a sandboxed solution.
II. Binding of content type to a list
III. Content type
IV. Custom action for a menu, the ribbon, or an administration page
V. Feature
VI. Only Features scoped to the site collection or the website are possible in sandboxed solutions. Farm and
web application scope are not possible.
VII. List/library instance
VIII. Site page, including both master page and content page
Application pages cannot be included in a sandboxed solution.
IX. Web Part
Only Web Parts derived from System.Web.UI.WebControls.WebParts.WebPart can be used in a sandboxed
solution. Web Part connections are not possible in sandboxed solutions.
X. Web template
A web template is deployed as a WebTemplate element along with an onet.xml file and optionally a
default.aspx file. A web template is functionally equivalent to a site definition configuration. Site definition
configurations cannot be deployed in a sandboxed solution.
Access data outside of sandbox scope:
Sandboxed Solutions in Partnership with Full-Trust Proxies
Several ways that sandboxed solutions can escape the usual restrictions on what they can access:
 Full-trust proxy operations: Create a special kind of operation that runs in a full trust process, but that can
be called from a sandboxed solution. The operation is deployed as a farm solution by a farm administrator
who trusts it and is prepared to let sandboxed solutions call it, this technique cannot be used when farm
deployment is not an option, such as “SharePoint Online”.
 using client object model code to access resources that are not otherwise available to sandboxed solutions.
Chapter 4—6 of 10
Sandbox solution deployment, Upgrade sandbox solutions:
 Installing a Sandboxed Solution:
Just as with a farm solution, there are two steps to installing a sandboxed solution, uploading and
activating.
a) Upload stage: The upload stage consists of uploading a sandboxed solution to the solution gallery of a
site collection. This parallels adding a farm solution.
b) Activation stage: The activation stage occurs after the solution is uploaded to a solution gallery.
Activating the solution makes it operate within the site by deploying files, registering event receivers,
and running solution validation. This parallels deploying a farm solution.
1. A sandboxed solution is installed by a site collection administrator to the site collection's solution gallery.
The following steps:
1) Click Site Actions, and then select Site Settings.
2) Click Solutions under the Galleries heading.
3) Click Upload Solution from ribbon.
4) Browse to the sandboxed solution package (.wsp file). Click Open.
5) In the Activate Solution dialog box, click Activate to activate the solution.
o If the sandboxed solution package contains a Feature it is activated automatically.
o When you add a sandboxed solution package through the object model, both site collection–scoped
and website-scoped Features must be activated on the Manage site features page
2. SharePoint Management Shell (Windows PowerShell). The commands are Add-SPUserSolution and Install-
SPUserSolution.
3. Microsoft Visual Studio, you can perform all installation steps by selecting Deploy Solution on the Build
menu.
 Uninstalling a Sandboxed Solution
1. There are also two steps to uninstalling a sandboxed solution.
Chapter 4—7 of 10
A. Deactivation stage: from the site collection's solution gallery. Which reverses previous actions
B. Deletion stage: from the solution gallery. A sandboxed solution cannot be deleted if it is still activated.
When a sandboxed solution is deleted, it is moved into the Recycle Bin and can be restored or deleted
permanently from the Recycle Bin.
2. using SharePoint Management Shell (Windows PowerShell). The commands are Uninstall-
SPUserSolution and Remove-SPUserSolution.
3. On your development computer, in Visual Studio, you can perform all uninstallation steps by
selecting Retract Solution on the Build menu.
 Upgrading a Sandboxed Solution
1. Installing a new sandboxed solution package (.wsp file) that has the same solution ID as the existing
sandboxed solution but a different hash code.
2. using SharePoint Management Shell (Windows PowerShell). The command is Update-SPUserSolution (not
Upgrade-SPUserSolution).
Implement custom solutions validators:
Validate Sandboxed Solutions using SPSolutionValidator:
What will happen?
If you have a custom Solution Validator hooked up with your farm, a custom error page will be displayed, and
the solution will not be activated.
Building a Solution Validator we need:
A Solution Validator
A feature to install/uninstall the validator in our Farm
Summary and reflections:
 If you want to create some kind of check to automatically validate solution that are uploaded by end-users in
their Solution Galleries, this is the way to do it.
 Solution validators are very easy to write, and they can be installed using a few different approaches. My take is
to create a farm feature, while you could still do it using powershell or in any way you want through the object
model.
Create a no-code solution
Configure no-code customizations for the SharePoint 2013 platformCreate XSLT for web parts
 Create SharePoint 2013 no-code solutions
I. What is a SharePoint Composite?
 A SharePoint Composite is a no-code, do-it-yourself business solution that you can create quickly by
assembling, connecting, and configuring the basic building blocks of functionality available in SharePoint 2013
and Office 2013. A SharePoint Composite combines data, documents, and business processes in a useful,
productive way.
 Or a web application that you can use to incorporate data quickly into a simple, visual, and interactive
solution. A SharePoint Composite can be:
 As simple as a custom webpage that uses a site list and several connected Web Parts.
 As sophisticated as a system that’s connected to a database by using Business Connectivity Services (BCS).
II. How-tos for creating no-code solutions?
Chapter 4—8 of 10
A. Using SharePoint 2013 Composites:
Provides links to many practical articles, walkthroughs, demos, virtual labs, and other formats that show how
to create no-code solutions.
B. Save, download, and upload a SharePoint 2013 site as a template:
Explains how to create site templates without using code so you can easily deploy no-code solutions.
 Design Manager in SharePoint 2013:
 Get an overview of using Design Manager to brand your SharePoint 2013 site.
 The designer will perform the following tasks:
1. Understand core SharePoint design concepts.
2. Create a mock-up of the design in HTML and CSS.
3. Implement the design by using Design Manager.
I. Use Design Manager to implement a design:
"design" is simply a group of files that implement:
 At least one HTML file that will be converted into a SharePoint master page.
 One or more CSS files.
 JavaScript files.
 Images.
 Other supporting files.
Create and upload JavaScript files
Uploading JavaScript (JS Files) as Javascript Display Template:
While working with SharePoint there is a common requirement to Upload JavaScript Files that you want to
use in one of your WebParts or with the new JS Link property of a List,Field,Form or a WebPart in your
SharePoint 2013 site.
You can either upload these .js files in:
I. The Styles, or
II. Site Asserts Library ,or
III. you can add it to the Master Page Gallery as a new JavaScript Display Template.
1) Navigate to the Master Page Gallery (Site Settings -> under Web Designer Galleries -> Master
Pages).
2) Select Files tab and then Upload Document.
3) Browse to the new JavaScript file that you have created and select Ok.
4) Next select “JavaScript Display Template” in the Content Type drop-down.
5) Next specify the Name, Title, Description properties along with some other properties
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488
SharePoint solution developer exam 70-488

Weitere ähnliche Inhalte

Was ist angesagt?

SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewRob Windsor
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Kashif Imran
 
Integrating Your Site With Internet Explorer 8
Integrating Your Site With Internet Explorer 8Integrating Your Site With Internet Explorer 8
Integrating Your Site With Internet Explorer 8goodfriday
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIRob Windsor
 
Customizing search result in share point 2013
Customizing search result in share point 2013Customizing search result in share point 2013
Customizing search result in share point 2013Chaitra Gopalakrishna
 
SharePoint Document Sets
SharePoint Document SetsSharePoint Document Sets
SharePoint Document SetsRegroove
 
SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010Becky Bertram
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGSanthosh Sap
 
Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APISparkhound Inc.
 
SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...
SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...
SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...Ivan Sanders
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Rob Windsor
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...SharePoint Saturday NY
 
Working With Sharepoint 2013 Apps Development
Working With Sharepoint 2013 Apps DevelopmentWorking With Sharepoint 2013 Apps Development
Working With Sharepoint 2013 Apps DevelopmentPankaj Srivastava
 
SharePoint 2010 - Was ist neu, was wird besser!
SharePoint 2010 - Was ist neu, was wird besser!SharePoint 2010 - Was ist neu, was wird besser!
SharePoint 2010 - Was ist neu, was wird besser!GFU Cyrus AG
 

Was ist angesagt? (15)

SharePoint 2010 Application Development Overview
SharePoint 2010 Application Development OverviewSharePoint 2010 Application Development Overview
SharePoint 2010 Application Development Overview
 
Sharepoint Online
Sharepoint OnlineSharepoint Online
Sharepoint Online
 
Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365Develop iOS and Android apps with SharePoint/Office 365
Develop iOS and Android apps with SharePoint/Office 365
 
Integrating Your Site With Internet Explorer 8
Integrating Your Site With Internet Explorer 8Integrating Your Site With Internet Explorer 8
Integrating Your Site With Internet Explorer 8
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
 
Customizing search result in share point 2013
Customizing search result in share point 2013Customizing search result in share point 2013
Customizing search result in share point 2013
 
SharePoint Document Sets
SharePoint Document SetsSharePoint Document Sets
SharePoint Document Sets
 
SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010SharePoint 2010 Tools in Visual Studio 2010
SharePoint 2010 Tools in Visual Studio 2010
 
MICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAININGMICROSOFT ASP.NET ONLINE TRAINING
MICROSOFT ASP.NET ONLINE TRAINING
 
Introduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST APIIntroduction to the SharePoint 2013 REST API
Introduction to the SharePoint 2013 REST API
 
SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...
SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...
SharePoint Intelligence Extending Share Point Designer 2010 Workflows With Cu...
 
Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010Data Access Options in SharePoint 2010
Data Access Options in SharePoint 2010
 
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
Lyudmila Zharova: Developing Solutions for SharePoint 2010 Using the Client O...
 
Working With Sharepoint 2013 Apps Development
Working With Sharepoint 2013 Apps DevelopmentWorking With Sharepoint 2013 Apps Development
Working With Sharepoint 2013 Apps Development
 
SharePoint 2010 - Was ist neu, was wird besser!
SharePoint 2010 - Was ist neu, was wird besser!SharePoint 2010 - Was ist neu, was wird besser!
SharePoint 2010 - Was ist neu, was wird besser!
 

Andere mochten auch

Exam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core Solutions
Exam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core SolutionsExam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core Solutions
Exam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core SolutionsBecky Bertram
 
ECM DocSpace based on Microsoft SharePoint (core solution)
ECM DocSpace based on Microsoft SharePoint (core solution)ECM DocSpace based on Microsoft SharePoint (core solution)
ECM DocSpace based on Microsoft SharePoint (core solution)Jane Timoshenko
 
SharePoint Certification: Deep Dive
SharePoint Certification: Deep DiveSharePoint Certification: Deep Dive
SharePoint Certification: Deep DiveNatallia Makarevich
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great InfographicsSlideShare
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShareKapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareEmpowered Presentations
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation OptimizationOneupweb
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingContent Marketing Institute
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 

Andere mochten auch (11)

Exam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core Solutions
Exam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core SolutionsExam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core Solutions
Exam Cram for 70-488: Developing Microsoft SharePoint Server 2013 Core Solutions
 
exam 70-488
exam 70-488exam 70-488
exam 70-488
 
ECM DocSpace based on Microsoft SharePoint (core solution)
ECM DocSpace based on Microsoft SharePoint (core solution)ECM DocSpace based on Microsoft SharePoint (core solution)
ECM DocSpace based on Microsoft SharePoint (core solution)
 
SharePoint Certification: Deep Dive
SharePoint Certification: Deep DiveSharePoint Certification: Deep Dive
SharePoint Certification: Deep Dive
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 

Ähnlich wie SharePoint solution developer exam 70-488

Implement Records Management in - SharePoint 2010 - EPC Group
Implement Records Management in - SharePoint 2010 - EPC GroupImplement Records Management in - SharePoint 2010 - EPC Group
Implement Records Management in - SharePoint 2010 - EPC GroupEPC Group
 
Ploneforwebdev
PloneforwebdevPloneforwebdev
Ploneforwebdevbrighteyes
 
CUST-3 Document Management with Share
CUST-3 Document Management with ShareCUST-3 Document Management with Share
CUST-3 Document Management with ShareAlfresco Software
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & DatabasesMuhammad Sajid
 
CSCI6505 Project:Construct search engine using ML approach
CSCI6505 Project:Construct search engine using ML approachCSCI6505 Project:Construct search engine using ML approach
CSCI6505 Project:Construct search engine using ML approachbutest
 
Elements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdfElements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdfJeff Smith
 
How to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured ContentHow to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured ContentAcquia
 
Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)kiwiboris
 
Drupal8 corporate training in Hyderabad
Drupal8 corporate training in HyderabadDrupal8 corporate training in Hyderabad
Drupal8 corporate training in Hyderabadphp2ranjan
 
Adopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuiteAdopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuiteAnswerModules
 
Explore SharePoint 2010 Enterprise & Document Management features
Explore SharePoint 2010 Enterprise & Document Management features Explore SharePoint 2010 Enterprise & Document Management features
Explore SharePoint 2010 Enterprise & Document Management features K.Mohamed Faizal
 
SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...
SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...
SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...Jonathan Ralton
 
( 12 ) Office 2007 Features Custom List
( 12 ) Office 2007   Features   Custom List( 12 ) Office 2007   Features   Custom List
( 12 ) Office 2007 Features Custom ListLiquidHub
 
Create Content Organizer Rules to Route Documents - SharePoint 2010 - EPC Group
Create Content Organizer Rules to Route Documents - SharePoint 2010 - EPC GroupCreate Content Organizer Rules to Route Documents - SharePoint 2010 - EPC Group
Create Content Organizer Rules to Route Documents - SharePoint 2010 - EPC GroupEPC Group
 
Salesforce winter 16 release
Salesforce winter 16 releaseSalesforce winter 16 release
Salesforce winter 16 releaseJitendra Zaa
 
Migrating very large site collections
Migrating very large site collectionsMigrating very large site collections
Migrating very large site collectionskiwiboris
 

Ähnlich wie SharePoint solution developer exam 70-488 (20)

People aggregator
People aggregatorPeople aggregator
People aggregator
 
Implement Records Management in - SharePoint 2010 - EPC Group
Implement Records Management in - SharePoint 2010 - EPC GroupImplement Records Management in - SharePoint 2010 - EPC Group
Implement Records Management in - SharePoint 2010 - EPC Group
 
Ploneforwebdev
PloneforwebdevPloneforwebdev
Ploneforwebdev
 
CUST-3 Document Management with Share
CUST-3 Document Management with ShareCUST-3 Document Management with Share
CUST-3 Document Management with Share
 
Data Transfer between Activities & Databases
Data Transfer between Activities & DatabasesData Transfer between Activities & Databases
Data Transfer between Activities & Databases
 
CSCI6505 Project:Construct search engine using ML approach
CSCI6505 Project:Construct search engine using ML approachCSCI6505 Project:Construct search engine using ML approach
CSCI6505 Project:Construct search engine using ML approach
 
Elements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdfElements_Creating_Content_Models.pdf
Elements_Creating_Content_Models.pdf
 
How to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured ContentHow to Optimize Your Drupal Site with Structured Content
How to Optimize Your Drupal Site with Structured Content
 
Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)Migrating Very Large Site Collections (SPSDC)
Migrating Very Large Site Collections (SPSDC)
 
Drupal8 corporate training in Hyderabad
Drupal8 corporate training in HyderabadDrupal8 corporate training in Hyderabad
Drupal8 corporate training in Hyderabad
 
Adopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuiteAdopting AnswerModules ModuleSuite
Adopting AnswerModules ModuleSuite
 
Intro to OctoberCMS
Intro to OctoberCMSIntro to OctoberCMS
Intro to OctoberCMS
 
Explore SharePoint 2010 Enterprise & Document Management features
Explore SharePoint 2010 Enterprise & Document Management features Explore SharePoint 2010 Enterprise & Document Management features
Explore SharePoint 2010 Enterprise & Document Management features
 
IBM File Net P8
IBM File Net P8IBM File Net P8
IBM File Net P8
 
SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...
SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...
SPSNYC14 - Must Love Term Sets: The New and Improved Managed Metadata Service...
 
( 12 ) Office 2007 Features Custom List
( 12 ) Office 2007   Features   Custom List( 12 ) Office 2007   Features   Custom List
( 12 ) Office 2007 Features Custom List
 
Create Content Organizer Rules to Route Documents - SharePoint 2010 - EPC Group
Create Content Organizer Rules to Route Documents - SharePoint 2010 - EPC GroupCreate Content Organizer Rules to Route Documents - SharePoint 2010 - EPC Group
Create Content Organizer Rules to Route Documents - SharePoint 2010 - EPC Group
 
Salesforce winter 16 release
Salesforce winter 16 releaseSalesforce winter 16 release
Salesforce winter 16 release
 
Migrating very large site collections
Migrating very large site collectionsMigrating very large site collections
Migrating very large site collections
 
Recsys 2016
Recsys 2016Recsys 2016
Recsys 2016
 

Kürzlich hochgeladen

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Kürzlich hochgeladen (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

SharePoint solution developer exam 70-488

  • 1. Chapter 1—1 of 1 Sharepoint Development Core Solution 70-488 Skills measured Eng.ahmed mostafa tawfik Sharepoint 2013 solution developer @AMostafaTawfik Thanks to everyone support me to finish these notes special thanks to: Eng.Mahmoud Hamed Mahmoud SharePoint | Office365 Evangelist, Architect, Developer @mhamedmahmoud This exam measures your ability to accomplish the technical tasks listed below. The percentages indicate the relative weight of each major topic area on the exam. The higher the percentage, the more questions you are likely to see on that content area on the exam. Please note that the questions may test on, but will not be limited to, the topics described in the bulleted text.
  • 2. Chapter 1—1 of 8 Chapter 1 Plan and design SharePoint sites (10‒15%) Manage the site life cycle Create a delayed site collection // “Select template later “ Create an empty site and pick a template later time SPSiteCollection.Add("/sites/site1", "SharePoint", null, 1033, null, "administrator", "Administrator","admin@contoso.com") Manage site collection disposition 1.1.1. Site Policy in SharePoint(Blog Post) Site Policies allow you to create a retention policy that can be applied to a site. Site Policy includes the following options: 1-Site Closure: The date the site is put into a "Closed" state. denote that the site is not being actively used any longer and will be moving to the next site lifecycle stage. Sites can be manually closed. Site owners can also manually reopen closed sites . 2-Site Deletion: The period of time following site creation or site closure that the site should be permanently deleted. When a site is deleted all its content and sub-webs are also deleted. 3-Postponement: This option will allow a site owner to manually postpone site deletion for a period of time determined by the Site Policy. 4-E-mail Notification: Before a site is deleted, an e-mail will be sent to site owners alerting them about the pending site deletion. Site Policy determines the period of time before scheduled site deletion that the e- mail is sent as well as recurrence frequency and timing of the e-mail alert. 5-Read-Only Mode: This setting puts the site collection and its subwebs into a read-only mode upon closure. Users can contact administrators to manually reopen the read-only site collection if need. 1.1.2. ProjectPolicy.CloseProject(SPWeb web) public static void CloseProject(SPWeb web) //Closes the site. this site must have a policy applied and opened. 1.1.3. ProjectPolicy.GetCurrentlyAppliedProjectPolicyOnWeb // Returns the policy that is applied on the site , Null if there is no policy applied on the site. public static ProjectPolicy GetCurrentlyAppliedProjectPolicyOnWeb(SPWeb web) Identify inactive site collections 1.1.4. SPSite.LastContentModifiedDate public DateTime LastContentModifiedDate { get; } //return System.DateTime object contain date //Gets the date and time when the content of the site was last changed. 1.1.5. SPSite.LastSecurityModifiedDate public DateTime LastSecurityModifiedDate { get; } //return System.DateTime object contain date //Gets the date and time when security on the site was last changed . Back up and archive site collection data Programatically: SPWebApplication myApp = SPWebApplication.Lookup(“url_of_Web_app”) SPSiteCollection mySiteCols = myApplication.Sites; // A-Backup mySiteCols.Backup(@"full url site collection", @"Path+file name", override previous backup or not); mySiteCols.Backup(@"http://Server/sites/MySiteCollection", @"OtherServerWSSBackupsSiteCollectionsBackupOfMySiteCollection", true); // B- Restore
  • 3. Chapter 1—2 of 8 mySiteCols. Restore (@"full url site collection", @"Path+file name", override exist site collection or not); mySiteCols.Restore(@"http://Server/sites/MySiteCollection", @"OtherServerWSSBackupsSiteCollectionsBackupOfMySiteCollection", true); Data Protection and Recovery Database Mirroring and Failover Database Snapshots SPBackupRestoreConsole Class //Provides static methods for running and managing backup and restore operations. Create content types Subscribe to published content types Introduction to Content Types (1) Definition: A content type is a reusable collection of metadata (columns), workflow, behavior, and other settings for a category of items or documents in SPList or SP Document Library manage the settings for this category in a centralized, reusable way and can be inherited,enableing Standarize by using it in all WebSite in the SiteCollection , Content Types are File Format Independent could be applied to any file format (word ,ppt,..) or without format (List Item ,Folders ,..). (2) Content Types Encapsulate Data Requirements , can include the following information: 1. The metadata, or properties, you want to assign to this type. 2. Custom New, Edit, and Display forms to use with this content type. 3. Workflows available for items of this content type. 4. Document template For document content types Any information necessary for custom solutions that are associated with this content type as XML . (3) Site and List Content Types:  Site Content Type: Content Type created on siteCollection but has not yet been added to list.  List Content Type: A Copy of the site content type and added to the list. (4) Default List Content Types:  every item has a content type assigned to it, either implicitly or explicitly ,so the list schema actually functions as the default content type of the list itself. Example Create an announcement list, and SharePoint Foundation copies the Announcement site content type locally to the list as the default list content type, create a document library and so on. (5) Content Type Scope:  All WebSites in the SiteCollection and every SubSite . (6) Content Type IDs: Content type IDs uniquely identify the content type and are designed to be recursive.  Rules of Assignment: The three most important built-in content types are Item, Document, and Folder. Any content type that you assign to a document library must inherit from Document or from a content type derived from Document. Moreover, any content type that you assign to a list must not derive from Document. The exception to this pair of rules is the Folder content type can exist on both lists and document libraries. (7) Content Type Groups:  The built-in content types are organized in groups such as List Content Types, Document Content Types, Folder Content Types, and “_ Hidden”.  you can create your Group for your Content Type.
  • 4. Chapter 1—3 of 8 (8) Designing Content Types you should Consider: A. Scope. Where in the site hierarchy do you want the content type to become available? B. Parent. Which existing content type you choose to derive your content type from?Your content type will not activate correctly if the parent content type is not available in the website where your content type is created. C. Columns. Which existing site columns are available for you to use plus Columns that are not inherited . D. Other Resources. Will the content type require language resources? Document templates? Forms? (9) Updating Content Types 2 Approaches: 1. Make the necessary changes to the content type // if you must make targeted, discrete changes to a content type that is in use. 2. Create a new content type with the necessary changes, deploy it wherever the previous content type exists, and then add the previous content type to the _Hidden content type group. // replace a content type that is currently in use , but still retain the current content type for items that are already assigned that content type.  Sealed Content Types can not updated before set sealed property to false (10) Deleting Content Types : cannot delete a site content type if it is being used as the basis for other site or list content types, otherwords you must be sure that the GetUsages method returns an empty list Subscribe to published content types i) How to: Customize Content Type Syndication (a) Ensure uniformity across lists so that they use the same content types, and therefore the same columns. (b) Content type can be shared within the farm or outside the farm with the managed metadata service application. (c) You can use the object model ContentTypePublisher class to customize content type syndication to create a new content type, publish it, and unpublish it on the hub site. ii) ContentTypePublisher Publishes or unpublishes a content type on the hub site. Methods: (Publish, Unpublish, IsPublished, IsContentTypeSharingEnabled ) Choose appropriate content type creation Using 3 ways: 1-SharePoint Foundation user interface. //UI 2- SharePoint Foundation object model. //Code 3-Deploying a Feature that installs the content type based on an XML definition file. //Declaretive  Except these you are defining content type not creating content type. 1.2. use Schema Development The Content Type Definition Schema defines the structure of the XML that creates a content type in the element manifest file of a Feature. <Elements Element (ContentType)> <ContentType Element (ContentType)> <Folder Element (ContentType) /> <FieldRefs Element (ContentType)> <FieldRef Element (ContentType)> <RemoveFieldRef Element (ContentType)> <XmlDocuments Element (ContentType)> <XmlDocument Element (ContentType)> <DocumentTemplate Element (ContentType)> 1.3. create content types using Object Model
  • 5. Chapter 1—4 of 8 SPWeb..> SPContentTypeCollection....> new SPContentType object....> Add(SPContentType) method of the SPContentTypeCollection Create site columns. A. Introduction to Columns  A site column is a reusable column definition, or template, that you can assign to multiple lists across multiple SharePoint sites.  Column Properties: 1. Name The column name must be unique among all column groups at the scope at which you create it. 2. Data type for example, single or multiple lines of text, number, currency, date and time, or calculation. 3. Detailed optional settings any other optional settings to apply for the data type you selected. 4. Column group to which this column belongs user-defined groups that help you organize your columns into logical categories.  Unlike content types, you cannot create a site column based on another site column. B. Updating Site Columns  write code that updates the site column, and then call the Update method.  SharePoint Foundation never writes changes made to a site column back to the site column definition itself. Instead,it stores updates made to site columns as entries within the SharePoint Foundation database. C. Fields and Field References Site Columns and List Columns are represented as either Field or FieldRef Element  Field elements ..............>> in site and list definitions (schemas).  FieldRef elements ......>> in content type definitions (schemas). You cannot create a column in a content type; you must create the column and then reference it in the content type definition. D. Enforcing Uniqueness in Column Values  New feature called unique column constraints, As stated.  a column that enforces a uniqueness constraint must be indexed.  SPField custPhone = custList.Fields["Phone Number"];  custPhone.Indexed = true;  custPhone.EnforceUniqueValues = true;  custPhone.Update(); E. Lookups and List Relationships  A lookup field is a field that is configured to get its value from a field in another list, When users create a new item, they do not type a value for the lookup column. Instead, they select a value from a drop-down list of the values in the column on the other list.  The SPList class has a GetRelatedFields method that you can use to discover lookup fields that point to a list.  List Relationships and Data Integrity: When you create or edit a lookup column through the user interface, you have the option to Enforce relationship behavior. If you select this option, you can then select either Restrict delete (Prevent Delete)or Cascade delete(Delete Related Field).  For SharePoint Foundation to either restrict or cascade deletions, the lookup field must be indexed.  A side-effect of choosing either to cascade or to restrict deletions is that the values of lookup fields are validated when they are set.  Creating Multiple-Column Lookups: create multiple-column lookups to the same lookup list.  // Create the primary column.  List.Fields.AddLookup(,,)  // Create the secondary columns.  List.Fields.AddDependentLookup(,,)  Discovering List Relationships:
  • 6. Chapter 1—5 of 8 You can discover which fields in related lists depend on information in a lookup list by calling the GetRelatedFields method on an SPList object that represents the lookup list. The method returns a collection of SPRelatedField objects. Content type inheritance:  SPContentType class //Represents a site or list content type.  public sealed class SPContentType Where a content type is used as the basis for another content type  SPContentTypeUsage class: //Used to track where a content type is used as the basis for another content type.  GetUsages(SPContentType) method, which returns a generic list of SPContentTypeUsage objects. 1.4. ContentTypeBinding Element:  Specifies a content type to provision on a list defined in the onet.xml schema.  Lists defined in the onet.xml schema cannot be modified directly. Manage content type behaviors Manage event receivers The SharePoint Foundation event model is built upon a common set of components and concepts, which are summarized in the remaining sections: 1. Before and After Events: a) Before events “ing” are always synchronous. b) After events “ed” execute in a different process from the triggering action, they can execute either synchronously or asynchronously. 2. Event Hosts: are objects, such as site collections, Webs, lists and list items, that expect to receive events – or, in other words, objects whose event receivers “listen” for SharePoint Foundation events. 3. Event Receivers and Handling Events: Event handler code is compiled into a .dll file and deployed to the GAC. i. create a new project of type "class library" and then inherit from one of the event receiver base classes. ii. override wanted methods iii. Binding ....77 4. Binding Event Handlers: “register” or binding is the process by which event handler code is associated with an object type by two ways: a) Declarative XML within a SharePoint Feature, either by list type or by content type, When you define a content type with a feature, you create two XML files: 1. Feature.xml: Define the metadata for the new feature. 2. Elements.xml: Define the assembly that encapsulates the event handler, the class itself, and also a sequence number that specifies the order, if multiple event handlers are associated with the Feature. b) Code that implements classes in the SharePoint object model.  SPList list = web.Lists["Shared Documents"];  SPEventReceiverDefinition def = list.EventReceivers.Add();  def.Assembly = "ERDefinition, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=704f58d28567dc00";  def.Class = "ERDefinition.ItemEvents";  def.Name = "ItemAdded Event";  def.Type = SPEventReceiverType.ItemAdded;
  • 7. Chapter 1—6 of 8  def.SequenceNumber = 1000;  def.Synchronization = SPEventReceiverSynchronization.Synchronous;  def.Update(); 5. Event Troubleshooting: a) The event behaviors has some issues should solved for events to work correctly manage workflow associations  public SPWorkflowAssociationCollection WorkflowAssociations { get; } SPContentType.WorkflowAssociations property: Gets an SPWorkflowAssociationCollection object that represents the workflow associations for this content type.  You can test for the existence of a workflow association in the content type’s collection by calling the GetAssociationByName method. If the return value of that method is not a null reference manage policies 1. An information management policy is a set of rules that govern the availability and behavior of a certain type of important content. 2. Policies provide the following benefits: 1.Administrators can set and manage "the rules" for a content type from a single location, including both client-side policy features and server-side policy features. 2.Policies are tightly coupled to the content. 3.Policies require little involvement from end users, because corporate policies are automatically and transparently followed. 3. Policy Architecture each policy is a collection of instruction sets for one or more policy features. Each policy feature provides a specific kind of content management functionality. You can assign a policy to a content type or to a list. 4. You can assign only one policy to a given content type or SharePoint list. However, that policy can contain any number of policy items. manage document templates  DocumentTemplate Element (ContentType): Specifies the document template for the content type. This is the file which SharePoint Foundation opens as a template when a user requests a new item of this content type. 1.5. Managing Document Templates with Content Types and Content Type Hub: If you are working on a hub site that publishes content types to other site collections, you can: a) Publish content types to make them available for use on subscribing sites. b) Republish content types so that subscribing sites can receive updates. c) Unpublish content types.  You have to run stsadm command to see the Content type publishing option appear in Site Collection Administration 1.6. Deploy a content type across a number of site collections: 1. Using content publishing: Setup the content type hub then Create a feature that contains a content type with a document template, and the document template itself then Deploy the feature to the farm, finally activate the feature on the content type publishing hub site collection. 2. Without using content publishing: using a site scoped feature then the _layouts approach is the only solution to make it easy by using a library to contain the templates Document templates need to be stored either in the 1- site collection where the content type is defined, or 2- in <SharePoint root>/Templates/Layouts (_layouts).
  • 8. Chapter 1—7 of 8 1.7. Deploying a Document Template file in Content Type in a (Office365) Sandboxed Solution: SP Root folder “15” is not accessible in Sandboxed solutions and hence it is not possible to deploy the document templates in _layouts folder, You will need to include the document template within SharePoint, meaning it will be stored in the content database. Steps: 1. Create and Configure a Module: In this step, you create a feature manifest file that contains a Module element. This specifies which files to deploy and where to deploy them. 2. Add the Module to a Feature: In this step, you create a feature and add your feature manifest file to the feature. This enables you to deploy the module to the SharePoint environment. Solution: a) Add the Templates module under your content type and delete the default files Sample.txt and Elements.xml added. b) Edit the content type Elements.xml and add the Module definition just before declaring the content type. c) update the DocumentTemplate reference in the content type definition. d) Deploy and test your solution. Implement site provisioning Create site definitions  A site definition defines a unique type of Microsoft SharePoint Foundation website.  To create a custom site definition with one or more configurations, follow the procedures:  Declarative task no code used  Adding (CAML) markup to two critical files: a WebTemp*.xml file and an Onet.xml file.  May create one or more custom site pages.  For globalization, you can also use of one or more resource (.resx) files.  do not edit the original WebTemp.xml file. Instead, create a custom WebTemp*.xml file  WebTemp.xml you are creating will be merged with the built-in file. Do not change the built-in file. The name of your custom file must match the pattern WebTemp*.xml.  Configuration: Specifies the set of lists, Features, and modules that are included when a site is created.  Modifying site definition: 1.SharePoint Designer :Modify site definition files to customize existing sites or lists is not supported. 2.Object model to modify sites after they are created.  Four site definitions whose configurations can be used to create new websites. 1.STS includes configurations for, Blank Site, Team Site, and Document Workspace. 2.MPS includes configurations for Basic Meeting Workspace, Blank Meeting Workspace, Decision Meeting Workspace, Social Meeting Workspace, and Multipage Meeting Workspace. 3.BLOG provides a site definition configuration for blogs. 4.SGS provides a site definition configuration for Group Work Site.  Core Schema Files:  WebTemp*.xml Files: Identify the site definitions, configurations and appearnce in the user interface (UI).  Onet.xml Files: Define the navigation areas, specify document templates and their files, define the base types for lists, and define configurations and modules for site definitions.  Each of these XML files uses (CAML) to define various aspects of a site. create web templates  created by two ways:
  • 9. Chapter 1—8 of 8 1. UI:When a user customizes a website in the (UI) or Microsoft SharePoint Designer, and then saves the website as a template, a web template is created, and stored in the Solutions Gallery of the top-level site in a site collection, where they become available for subsite creation on all websites in the site collection. 2. Code: by create new project Import SharePoint Solution Package project as sandboxed solution, then Download the solution (.wsp) file from the Solution Gallery and point to it as the project source, finally edit the files as needed (WebTemplate element, Onet.xml file,...).  A web template is persisted in the SharePoint database as a Solution, which is a file .wsp extension, a .wsp file is actually a .cab file (library of compressed files stored as a single file).  Web templates can be downloaded, edited, and redeployed as a sandboxed solution to other site collections.  Easy to create, are easy to Deploy, modified without affecting the sites that have been created. implement feature stapling “Feature/Site Template Association” allow you to associate new Features and functionality with existing site definition configurations Two Features are involved in a Feature/site template association: 1. the Feature containing the functionality you want to add to an existing site definition configuration. 2. The Feature/site template association. Possible scopes: a) Farm: Yes b) Web Application: Yes c) Site Collection: Yes d) Web Site: No implement custom provisioning code public abstract class SPWebProvisioningProvider ( ) //Provides a handler for responding to Web site creation. use ApplyWebTemplate method
  • 10. Chapter 2—1 of 82 Chapter 2 Implement authorization and authentication (10‒15%) Implement user authentication Create a custom claims provider  Introduction to Creating Custom Claims Providers in SharePoint  There is two security models: A. Classic Mode: older version B. Claims Mode: new model  When a web application that runs in Claims Mode authenticates a user, it creates a security token for the user by using Security Assertion Markup Language (SAML).  What is powerful about creating a custom claims provider is that your code is called each time the hosting web application authenticates the user and creates a SAML token. Your code is then given the opportunity to do the following: 1) Determine who the user is. 2) Query for information about the user. 3) Add claims about the user into the resulting SAML token. 4) A custom claims provider supplies an important point of interaction for SharePoint site administrators who are configuring permissions on lists and sites.  Two Types of claims providers: a) People picker claims provider: enable a user to search and resolve entities in the standard people editor controls provided by SharePoint Foundation. b) Claims augmentation provider: Used to augment the claims (such as attributes) of a user. For example, can add custom claims to a user's security token, which provides more flexibility when you configure permissions on sites, lists, items, and documents.  Code:  Add new class that inherits from SPClaimProvider, add a public constructor that takes a single string parameter and passes it to the base class constructor. class AudienceClaimProvider : SPClaimProvider { public AudienceClaimProvider(string displayName): base(displayName) {} }  Define one or more claim types. A claim type is identified by a unique string, and by URI  A claims provider requires a name and a description for registration internal const string.  SPClaimProvider has several methods and properties that you must override.  bring the claims provider to life, using two methods FillClaimTypes and FillClaimValueTypes , FillEntityTypes.  Adds claims to the user's SAML token.  implement the methods of the SPClaimProvider class that interact with the People Picker page: FillSearch : search in the People Picker page, creates a picker entity object for each audience match by using a utility method named CreatePickerEntityForAudience,  Conclusion The ability to create custom claims providers for Microsoft SharePoint, enables you to move beyond simple security schemes where permissions can be configured only in terms of user account names and groups. By adding custom claims into the SAML security tokens of your users, you can make it possible for site administrators to configure security permissions in terms of new abstractions—such as Users Over 21, Naturalized United States Citizens, Managing Partners.. . package and deploy a custom claims provider  SPClaimProviderFeatureReceiver class: Defines a class for provisioning and unprovisioning a single claim provider.  [SharePointPermissionAttribute(SecurityAction.Demand, ObjectModel = true)]  public abstract class SPClaimProviderFeatureReceiver : SPFeatureReceiver
  • 11. Chapter 2—2 of 82 create a custom membership provider &package and deploy a custom membership provider  Claims Walkthrough: Learn how to create forms-based authentication for claims-based web applications by using a custom membership and role provider as the authentication provider..  Overview of Authenticating Claims-Based Web Applications by Using Custom Membership and Role Providers 1: Reviewing the Membership and Role Provider Code 2: Building and Deploying the Membership and Role Provider 3: Creating a SharePoint Web Application 4: Configuring the Membership and Role Provider for the SharePoint Web Application 5: Testing Forms-Based Authentication 6: Viewing Claims  Conclusion: Forms-based authentication provides custom identity management create a custom sign-in page with Forms Based Authentication.  Configure Forms Based Authentication in SharePoint  Create a New SharePoint Application choose “Claims Based Authentication” for the Authentication type, create the site collection.  Enable and configure the forms based authentication settings. 1) Create the database using aspnet_regsql 2) Add users and roles using the Web Site Administration Tool 3) Add connection strings in the web.config for:  Your application  Central Administration  Secure Token Service Application 4) Add membership and role providers for:  Your application  Central Administration  Secure Token Service Application 5) Edit web.config for Central Administration  Set the default provider for roles as AspNetWindowsTokenRoleProvider  Set the default provider for membership as your new membership provider  Add the PeoplePickerWildcards entry 6) Edit web.config for the Secure Token Service Application  Set the default provider for roles as your provider  Set the default provider for membership as your provider 7) Add the FBA administration user to Central Administration 8) Add FBA roles to SharePoint groups Creating a Login Page: A. Create new Empty SharePoint Project. B. Choose Farm Solution. C. Add a new item to the project “Application Page”. D. Add a reference to the assembly “Microsoft.SharePoint.IdentityModel”. E. Update the markup for the page. F. Create the code-behind for the page. G. Inherit from FormsSignInPage Configure your custom login page: 1. In Central Administration, click on “Manage web applications”. 2. Click your web site. Then click the “Authentication Providers” ribbon button. 3. Finally choose the zone that you want to configure, enter Sign In Page URL.
  • 12. Chapter 2—3 of 82 authenticate a user from a client application The 3 Object Models with their available authentication methods are: 1. .NET Client Object model o The default is to authenticate users via their current Windows credentials (NTLM and Kerberos). o Possible for you to define other authentication methods like Anonymous or Forms Authentication. 2. Silverlight Client Object model o Default is to authenticate users via their current Windows credentials (NTLM and Kerberos). o It is possible for you to define other authentication methods like Forms Authentication. o It is not possible to use the Silverlight client object model with anonymous authentication. 3. ECMA Script Client Object model o No need for additional authentication as JavaScript already runs in an authenticated page. ClientContext clientContext = new ClientContext("http://ltp-21:31890"); //Set the AuthenticationMode clientContext.AuthenticationMode = ClientAuthenticationMode.FormsAuthentication; //Instantiate a FormsAuthenticationLoginInfo object. FormsAuthenticationLoginInfo formsAuthInfo = new FormsAuthenticationLoginInfo("MyFormsTestUser", "MyUserPassword!2"); //Specify the login details using the FormsAuthenticationLoginInfo object. clientContext.FormsAuthenticationLoginInfo = formsAuthInfo; Web site = clientContext.Web; clientContext.Load(site); clientContext.ExecuteQuery(); Console.WriteLine("Title: {0}", site.Title);  Using the Client Object Model with a Claims Based Auth Site: 1.1. What's new in SharePoint 2013 for authentication, authorization, and security? A. User sign-in:  SharePoint 2013 continues to offer support for both claims and classic authentication modes.  Claims authentication is the default authentication option in SharePoint 2013.  Classic-mode authentication is deprecated and can be managed only by using PowerShell.  The MigrateUsers method from SharePoint 2010 is now deprecated, it's no longer the correct way to migrate accounts. To Migrate accounts from classic-mode in SP2010 to claims-based authentication in SharePoint 2013, use the new Windows PowerShell cmdlet called Convert- SPWebApplication.  Requirement to register claims providers is eliminated. However, you do have to pre-configure claims type.  SharePoint 2013 tracks FedAuth cookies in the new distributed cache service using Windows Server AppFabric Caching.  Significantly more logging is provided to help troubleshoot authentication issues. B. Services and app authentication:  A app for SharePoint has its own identity and is associated with a security principal, called an app principal. Like users and groups, an app principal has certain permissions and rights.  In SharePoint 2013, the server-to-server security token service (STS) provides access tokens for STS authentication. The STS enables temporary access tokens to access other application services, such as Exchange Server 2013 and Microsoft Lync 2013, and apps for SharePoint 2013. Authentication and authorization  SharePoint 2013 supports security for user access at the website, list, list or library folder, and item levels, making it easier to manage user rights and group rights throughout a website.
  • 13. Chapter 2—4 of 82  Authorization: which users can perform specific actions on a given object.  Authentication: Windows authentication or non-Windows authentication.  Windows authentication: allows IIS to perform the authentication for SharePoint 2013, supporting all (IIS) and Windows authentication integration options, including Basic, Digest, Certificates, Windows NT LAN Manager (NTLM), and Kerberos.  ASP.NET Forms: A non-Windows identity management system that uses the ASP.NET forms- based authentication system. Claims-based identity and authentication  Claims-based identity is an identity model in SharePoint 2013 that includes features such as authentication across users of Windows-based systems and systems that are not Windows-based, multiple authentication types, stronger real-time authentication, a wider set of principal types, and delegation of user identity between applications, supporting The following sign-in or access modes: a) Windows claims–mode sign-in (default) b) SAML passive sign-in mode c) ASP.NET membership and role passive sign-in d) Windows classic–mode sign-in (deprecated in this release)  Single sign-on is much easier to achieve, and your application is not responsible for the following: i. Authenticating users ii. Storing user accounts and passwords iii. Calling to enterprise directories to look up user identity details iv. Integrating with identity systems from other platforms or companies Forms-based authentication  provides custom identity management in SharePoint 2013 by implementing: a a) Membership provider, defines interfaces for identifying and authenticating individual users. b) Role manager, which defines interfaces for grouping individual users into logical groups or roles.  The membership provider validating the credential information by using the System.Web.Security.Membership.ValidateUser method  The role manager is optional. If a custom authentication system does not support groups, a role manager is not necessary.  SharePoint 2013 supports one membership provider and one role manager per URL zone.  The ASP.NET forms roles have no inherent rights associated with them. Instead, SharePoint 2013 assigns rights to the forms roles through its policies and authorization.  In ASP.NET membership and role passive sign-in, the sign-in happens by redirecting the client to a web page where the ASP.NET log-in controls are hosted. After the identity object that represents a user identity is created, SharePoint 2013 converts it to a ClaimsIdentity object (which represents a claims-based representation of a user). Implement application authentication and authorization Use the SharePoint App TokenHelper class Authorization, users, groups, and the object model in SharePoint 2013 1) Introduction i) Access to SharePoint 2013 objects is controlled through a role-based membership system by which users are assigned to roles that authorize their access to SharePoint 2013 objects. ii) Groups consist of users and may or may not be assigned to roles. SharePoint 2013 includes the following three groups by default:  owners (administrator)  members (contributor)  visitors (reader) 2) Security policy
  • 14. Chapter 2—5 of 82  provides a way to enforce uniform security throughout all site collections within a web application  In policy roles, the users and groups are identified by both their security identifier (SID) and their login or user name.  Central administration policy roles differ from the role definitions for a site collection. 3) Users, groups, and principals user (SPUser) gains access to a SharePoint object two ways: I. directly through an individual role assignment, ..> the user is the principal II. indirectly through membership in either a domain group or a SharePoint group (SPGroup) that has a role assignment, ...> the domain group or SharePoint group is the principal user-based permissions management through two ways: 1) access control lists (ACLs) for small number of users. 2) Group-based for larger number of users. SharePoint Server groups supports two kinds of: i. Domain groups: remain outside SharePoint Server control; users cannot use SharePoint Server to define, browse, or modify domain group membership, Domain groups can be used anywhere within the scope of the Active Directory directory service. ii. SharePoint groups: are scoped to the site-collection level, and they can be used only within the site collection.  Principal is a user or group that is used to control security: A. If you add a user to a site, the user is the principal, but B. if you add a group to the site, the group is the principal.  By using groups, a smaller number of principals can be used to grant access to a much larger number of users. 4) High-level view of object relations—scopes, users, groups, and roles A scope represents a uniquely secured object or set of objects. [site, list, folder or item level] Users groups (N : N):Each user (SPUser) can be a member of multiple groups, and each group (SPGroup) can contain multiple users. Rights and role definitions (N to N):  Right”insert list item ” can be in multi role defnitions [Contributor, Designer, and Administrator]  Role definition “Contributor” can also contain multiple rights. [inserting, updating, and deleting list items]. 5) User tokens and access control lists  To make checking permissions faster, SharePoint Server implements user tokens and ACLs in its security model.  The user token identifies the authentication process applied to a user.  ACL is a binary object that determines the rights that users and groups have on a given object.  An ACL consists of multiple ACEs, each security principal (user or group) being one ACE in the ACL 6) Object model changes: obsolete but backward-compatible security objects The following security objects used in WSS 2.0 are obsolete, but continue to function: I. Microsoft.SharePoint.SPPermission II. SPPermissionCollection III. SPRights IV. SPRole
  • 15. Chapter 2—6 of 82 V. SPRoleCollection Replaced by: i) SPBasePermissions “Right” ii) SPRoleDefinition “RoleDefinition” iii) SPRoleAssignment “RoleAssignment” 7) Guest roles (Limited Access) to accommodate shared resources  The concept of a guest role is extended to include folder-level permissions and list-level permissions.  When a user is granted permissions on a folder, they are also granted the Guest role on the parent list of that folder and on the parent website 8) Removing users from a scope or from all scopes The only way to remove a user from all scopes is to delete that user from the site collection, which removes the user from all roles in all scopes within the site collection. 1.2. Use the SharePoint App TokenHelper class, App authentication in SharePoint i. The authentication process verifies a claim that is made by a subject (in this case, an app) that it should be allowed to act on behalf of a given principal (in this case, an authenticated SharePoint user) Authorization policies:  The authorization process verifies that an authenticated subject (an app or a user or both) has permission to perform certain operations or to access specific resources  three types of authorization policies: a) User-only policy.In SP2010 content database authorization checks succeed if user has permissions b) App-only policy, Ex:expense submission app. if App has permissions c) User + app policy. App Part “iframe” if user +App permissions  App permissions and app permission request scopes App developer should specify through the app manifest file, the permissions an app needs to SharePoint resources outside the app web. OAuth 2.0 in SharePoint 2013:  OAuth 2.0 is an open framework for authorization.  OAuth enables secure authorization from desktop and web applications in a simple and standard way.  OAuth enables a user to approve an application to act on his or her behalf without sharing his or her user name and password.  For example, user can share private resources (documents, photos, videos and so on) on one site with another site, without requiring credentials (typically user name and password).  OAuth enables users to provide access tokens, instead of credentials, Each token grants access to a specific resource provider (website) for specific resources (ex:documents in a SharePoint document library) and for a defined duration (ex:12 hours) A typical apps for SharePoint scenario is as follows: 1) A user signs in to SharePoint and is authenticated. 2) The authenticated user then installs an app for SharePoint from either the Office Store or the app catalog. 3) The app is granted permission by the user to access SharePoint resources. 4) When an authenticated user (not necessarily the same one who installed the app) launches the app, SharePoint POSTs a context token to the app. 5) The app then calls back to SharePoint to access the SharePoint resources on behalf of the user by using an access token. When is OAuth used? i. If you plan to build an app for SharePoint that runs in an remote web application and communicates back to SharePoint using server-side code. Remote Web application:  Off premise: use the ACS authorization system in which ACS is the token issuer.
  • 16. Chapter 2—7 of 82  On premise: use the high-trust system in which the app itself and a digital certificate are the token issuers. ii. The OAuth 2.0 framework uses token passing "flows" to: a) Authorize requests by an app for SharePoint to access SharePoint resources. b) Authenticate apps in the Office Store, an app catalog, or a developer tenant.  When is OAuth not used?  When make a call from the app web itself or from JavaScript a remote webpage using the cross- domain library.  Access tokens:  To access resources, an app has to request an access token from an OAuth security token service (STS)  In contrast, the WS-Federation STS and the Security Assertion Markup Language (SAML) passive sign-in STS are primarily intended to issue sign-in tokens.  An example of an OAuth STS is Microsoft Azure Access Control Service (ACS).  OAuth STS is not used for issuing sign-in tokens, that is, they are not used as identity providers. So, you will not see an OAuth STS listed in the user sign-in page, the Authentication Provider section in Central Administration, or the people picker in SharePoint. specify the App permission request scope manifest and permission request manifest:  Certain APIs require a user context and can't be executed with an app-only policy.  Apps that do not make OAuth authenticated calls (for example, apps that are only JavaScript running in the app web) cannot use the app-only policy. They can request the permission, but they will not be able to take advantage of it because doing so requires passing an app-only OAuth token. Only apps with web applications running outside of SharePoint can create and pass app-only tokens.  OAuth and server-to-server calls should use the app-only policy if:  The app needs to elevate its permissions above the user for a specific call (for example, to approve an expense report under conditions evaluated by the app).  The app is not acting on behalf of any user (for example, the call is being made by the app alone, not by a user who is using the app). App permissions in SharePoint 2013 i. Introduction: An app has the following basic information:  Client Id.  Display name.  The app domain. ii. Types of app permissions and app permission request scopes:  The permission requests specify both the rights that an app needs and the scope at which it needs the rights.  Types of app permisson:  Permission request scopes indicate the location in the SharePoint hierarchy where a permission request applies.  SharePoint 2013 supports scopes within the content database and tenancy: 1) site collection 2) website 3) list 4) Tenancy  If an app is granted permission to one of the scopes, the permission applies to all children of the scope.  Because permission requests are made without information about the topology of the site collection where the app is installed, the scope is expressed as a type instead of as the URL iii. Understanding differences between app permission rights and user rights
  • 17. Chapter 2—8 of 82 App can have the following rights: a) Read: Enables apps to view pages, list items, and download documents. b) Write: view, add, update, and delete items in existing lists and document libraries. c) Manage:view, add, update, delete, approve, and customize items or pages within a web site. d) FullControl:Enables apps to have full control within the specified scope. e) Query right For Search only.  These rights correspond to the default user permission levels: Reader, Contributor, Designer, and Full Control.  Unlike SharePoint user roles, these rights levels are not customizable.  App rights names do not match the corresponding SharePoint user roles, except Full Control, which can't be customized through the permissions management user interface.  Permissions that are not known to SharePoint 2013 are ignored. iv. Permission request scopes, available rights, and Office Store apps rights Different scopes have different sets of rights that are available for an app to request: I. Office Store apps: Only Read, Write, and Manage rights are allowed no full control. II. site collection website list: Read, Write, Manage and full control. III. other SharePoint features:  BCS Read.  Search QueryAsUserIgnoreAppPrincipal.  Project Server Read, Write, Manage , SubmitStatus and Elevate.  Social features Read, Write, Manage and full control.  Taxonomy app Read and Write. Apps that request more than Manage permissions can still be deployed through the app catalog as it is blocked through “office store”. v. Managing app permissions  The SharePoint 2013 implementation of the OAuth protocol, end users have four different opportunities to manage app permissions: 1) During app installation 2) By using explicit permissions management 3) By using an end-user consent UI 4) During app removal vi. Next steps  How to: Create a basic provider-hosted app for SharePoint  Tips and FAQ: OAuth and remote apps for SharePoint  OAuth authentication and authorization flow for cloud-hosted apps in SharePoint 2013 Plan app permissions management in SharePoint 2013 App permissions management manage the ability of apps to access and use internal SharePoint 2013 resources and perform tasks on behalf of users. Introduction To plan the management of app permissions you have to: a) Determine the specific SharePoint 2013 resources that the app will need to access, and where those resources reside. b) Determine the minimum permission level that will be required to enable the app to function correctly. c) Determine the appropriate app authorization policy to ensure that the app functions correctly and complies with specified authorization requirements. d) Determine who will be installing the apps and who will be using them. App permission request scopes  Specify the level at which the app is intended to run, and the permission level that is assigned to the app.  Permission request scopes: 1) SPSite Defines the app permission request scope as a SharePoint 2013 site collection.
  • 18. Chapter 2—9 of 82 2) SPWeb web site. 3) SPList list. 4) Tenancy Tenancy  App permission requests are collections of permissions that enable apps to perform specific tasks. For example Read (View Items, Open Items, View Versions, Create Alerts, View Pages). specify permissions for Office Store apps, Only Read, Write, and Manage rights are allowed for Office Store apps specify permissions for Corporate Catalog Apps, specify permissions for remote apps to access SharePoint data ???????????? 1.3. Build apps for SharePoint  What is an app for SharePoint in SharePoint 2013?  Is a solution that carries a light footprint and uses standards-based technologies such as HTML5, JavaScript, and Oauth, to extend the capabilities of a SharePoint website.  light footprint because they don't actually install on the host server, and that means they don't overload a SharePoint site with excessive API calls. Why build apps for SharePoint? a) A familiar programming model, plus popular technologies and languages For apps, the web is the platform. If you can build a web application, you can build an app for SharePoint, Use any language [HTML, JavaScript, PHP, or .NET] - and your favorite web development tools [Visual Studio 2012 or the new "Napa" Office 365]. Have a similar development process for any device you are targeting – mobile phones, tablets, or computers – so you can be more efficient and productive. Separate the app’s logic data[sql,mysql,..]and user interface (UI)[JS,ASP.net,..] to fit your needs. Use the expanded capabilities of REST and client APIs (JavaScript and .NET) to access the rich data and services in SharePoint such as search, workflow, social networking, taxonomy, user profiles, and Business Connectivity Services (BCS). Use the new OAuth 2.0 support in SharePoint. b) Multiple options for hosting 1. SharePoint-hosted apps  Apps where all components are hosted on either an on-premises or Office 365 SharePoint farm.  Installed on a SharePoint 2013 website, called the host web. They have their resources hosted on an isolated subsite of a host web, called the app web.  Deployed to app webs, rather than the host web for Two Reasons: a) Enforcement of app permissions: App has it’s permissions that are not necessarily the same as the permissions of the user who is executing the app. b) Cross-domain scripting security: Ensure that JavaScript in the app for SharePoint cannot execute any JavaScript from any other domain.  You can combine a SharePoint-hosted app with apps that have remotely hosted components, but any app or portion of an app that runs on an app web has the following set of requirements for three key components: a) where the app is hosted. b) How the app gets authorization. c) What language it can use.  Advantaged “Benifits” of SharePoint-hosted apps? 1. Reuse common SharePoint items, like lists and Web Parts, BUT Only JavaScript no server side code
  • 19. Chapter 2—10 of 82 2. Easy to create and deploy, so they are good for small team productivity apps and business process automation, with lower complexity business rules, BUT Your app has only the authorization privileges of the signed-in user. 3. Learn how to create a basic SharePoint-hosted app. 2. Provider-hosted apps  Include components that are deployed and hosted outside the SharePoint farm. They are installed to the host web, but their remote components are hosted on another server.  A provider-hosted app interacts with a SharePoint site but also uses resources and services that are located on the remote site.  Requirements three key components: a) where the app is hosted. Any web server or hosting service. b) How the app gets authorization. OAuth or the JavaScript cross-domain library. c) What language it can use. Any language supported by your web server or hosting service. Get these benefits But consider this  Host the app on Microsoft Azure or any remote web platform, including non-Microsoft platforms.  You are responsible for creating the installation,upgrade and uninstallation logic of the remote components.  Use one of the SharePoint client object models, the JavaScript cross-domain library, or REST/OData-based web service to interact with SharePoint.  Each way of interacting with SharePoint has corresponding options for approaches to data access.  Gain authorization to SharePoint data using either OAuth or the JavaScript cross-domain library.  You need to decide between OAuth and the cross-domain library to authorize your app’s access to SharePoint.  3. AutoHosted Apps J c) A familiar web experience, yet more flexible Apps for SharePoint have the same user experience as SharePoint websites but are more: 1) As an immersive full-page experience 2) As part of a webpage, using app parts to surface an iframe element that contains the app 3) As UI custom actions, extending ribbons and menus by adding the app to list items, documents, and more d) Integrates with apps for Office Use the Office Store to sell your app for SharePoint e) Lets you reach users through the Office Store and the App Catalog  Use the Office Store to sell your app for SharePoint to users  Apps for a company are deployed to the organization's internal App Catalog hosted on SharePoint,
  • 20. Chapter 2—11 of 82  Start developing apps for SharePoint Building an app for SharePoint  To build your app for SharePoint, you must do the following: 1) Configuring an app  An app for SharePoint is configured with SharePoint using an app manifest—an XML file that declares the app’s basic properties, where it runs, and what to do when it starts. An app manifest file can do many things: A. Use different authentication schemes (app principals) and declare the permissions the app needs. B. Can also include tokens that are replaced at build/run time, so you can reference your app and pass context (for example, the SharePoint language and where the app is installed) C. Tells SharePoint to register the app and invoke a remote page when the app starts. 2) Deciding where the app’s code runs (hosting options)  Host in SharePoint, in the cloud, or a mix of SharePoint and cloud. 1. Provider-hosted apps: You must host a provider-hosted app on a dedicated server or third-party hosting service. Depending on your choice, these apps run either on your server or in the cloud. 2. SharePoint-hosted apps: When the app is hosted in SharePoint itself, the code is only in HTML and JavaScript and is hosted by SharePoint. 3. Hybrid apps (components in both SharePoint and the cloud): In these apps, SharePoint components run in SharePoint while components hosted in the cloud run in the cloud. 3) Communicating with SharePoint using SharePoint APIs  Apps show their power when they use SharePoint APIs to connect and integrate with SharePoint features— search, workflow, social networking, taxonomy, user profiles, BCS, and more. This lets them read documents, do searches, connect people, and much more. SharePoint APIs include the following: i. REST APIs and JavaScript APIs ii. Managed APIs (.NET) 4) Packaging and distributing an app Apps for SharePoint are distributed as an app package, and the components it contains depend on where your app is hosted.: a. A provider-hosted app package might contain only the app manifest if the app is hosted on a dedicated server or third-party hosting service. b. A SharePoint-hosted app package might contain some SharePoint-related components and the app manifest.,App packages can include components such as apps for Office. Plan and implement user authorization
  • 21. Chapter 3—1 of 10 Chapter 3 Access and manage data (10‒15%) Design solutions to handle large amounts of data Create efficient CAML (Collaborative Application Markup Language )queries and views Query Schema: The Query schema of (CAML) is used in various ways within the context of Microsoft SharePoint Foundation to define queries against list data. Assign CAML query strings to : i. Query property of several classes in the server and client object models in order to return data, or ii. Method parameters of the Lists web service to work remotely with data. iii. Context of CAML views to return specific data. View Schema:  The View schema of (CAML) is used to define how the contents of a list view are rendered in Microsoft SharePoint Foundation.  SharePoint Foundation uses XSLT to define list views(includes a query that returns the data that is displayed in view)  Views can be created or modified programmatically through either the server-side or client-side object model.  Specialized rendering elements are used within a view to define the logic for constructing HTML. Handling Large Folders and Lists: When the size of folders and lists increases, you must optimize performance.  You should concern : 1. Query throttling, which can cause code to change in unexpected and unpredictable ways over time as your site evolves and your queries begin to return items that exceed the query threshold. 2. Efficient retrieval of items from large folders and lists.  To view and increase this threshold or to enable the object model to override the threshold  On the Central Administration site, under Application Management, click Manage Web Applications.  Click General Settings, and then click Resource Throttling.  View and update the threshold or allow the object model to override the limit.  When you are working with folders and lists:  Do not use SPList.Items.  SPList.Items selects all items from all subfolders, including all fields in the list. Use the following alternatives for each use case:  Adding an item:  Instead of calling SPList.Items.Add, use SPList.AddItem.  Retrieving all items in a list:  Instead of using SPList.Items, use SPList.GetItems(SPQuery query) .  Apply filters, if appropriate, and specify only the fields you need to make the query more efficient.  Getting items by identifier  Instead of using SPList.Items.GetItemById, use SPList.GetItemById(int id, string field1, params string[] fields). Specify the item identifier and the field that you want.  Do not enumerate entire SPList.Items collections or SPFolder.Files collections.  Table 1. Alternatives to enumerate SPList.Items Poor Performing Methods Better Performing Alternatives SPList.Items.Count SPList.ItemCount SPList.Items.GetItemById(System.Int32) SPList.GetItemById(System.Int32)  When you delete multiple versions of a list item, use the DeleteByID() method; do not use the Delete() method. Choose appropriate APIs
  • 22. Chapter 3—2 of 10  Types of APIs including: 1) Server object model. 2) Various client object models.[ JavaScript, .NET Framework, Mobile, .. ] 3) REST/OData web service.  Factors that determine which API set to use a) The type of application: A. an app for SharePoint. B. Web Part on a SharePoint page. C. JavaScript running in a SharePoint site page. D. Application page....... b) Your existing skills:Using any of the following programming models: 1. JavaScript 2. ASP.NET 3. REST/OData 4. .NET Framework 5. Windows Phone 6. Windows PowerShell c) The device on which the code runs: a) Server in the SharePoint farm. b) External server such as a server in the cloud. c) Client computer. d) Mobile device. If you want to do this ... ... use these APIs  Create an HTML/JavaScript application that performs CRUD operations on SharePoint data or  Create an app for Office that works with SharePoint JavaScript client object model  Create a custom Web Part, application page, or ASP.NET user control or  Create a timer job Server object model  Create a LAMP web application that performs CRUD operations on SharePoint data or external data that is surfaced in SharePoint by a BCS external content type or  Create an iOS or Android app that performs CRUD operations on SharePoint data REST/OData endpoints  Server object model The largest set of APIs is in the server object model of managed classes. classes are added SP2013 to enable programming of:  Enterprise Content Management (ECM).  User profiles.  Taxonomy.  Advanced search. Limitations of server object model: You cannot use the server object model in an app for SharePoint,  Client object models: Client object models in SharePoint 2013: 1) .NET: Are sent to the SharePoint server in batches where they are converted to server-side code and executed. Developer determine whether a batch runs Synchronously or Asynchronously.  Synchronous batch: the .NET Framework application waits for the returned results from the server .  Asynchronous batch: client-side processing continues immediately and the client (UI) remains responsive. 2) Silverlight: Silverlight .xap files can be included in apps for SharePoint, including SharePoint-hosted apps. 3) Mobile.  JavaScript object model  Use in either inline script or separate .js files.  It includes all the same functionality as the Silverlight client object models. and .NET Framework .
  • 23. Chapter 3—3 of 10  In addition, it is now possible to access SharePoint data across domains in JavaScript (but only data that is within the same parent site collection), which was not allowed in previous versions of SharePoint. Data is returned from the server in JavaScript Object Notation (JSON).  The JavaScript object model is defined in a set of *.js files located at 15TEMPLATELAYOUTS on each server.  REST/OData endpoints  Representational State Transfer (REST) web service that uses the OData protocol to perform CRUD operations on SharePoint list data.  Used when you need to access SharePoint entities from client technologies that do not use JavaScript and are not built on the .NET Framework or Silverlight platforms  To use the REST capabilities, your code constructs a RESTful HTTP request to an endpoint that corresponds to the desired client object model API.  The client.svc web service handles the HTTP request and serves a response in either Atom or JSON format.  almost every API in the client object models has a corresponding REST endpoint. This enables your code to interact directly with SharePoint artifacts by using any technology that supports standard HTTP requests and responses.  Comparing REST/OData programming with client object model programming Feature .NET Framework or Silverlight object models JavaScript object model REST/OData endpoints called from a Windows platform or JavaScript Object-oriented programming Yes Yes No Batch processing Yes Yes No APIs for conditional processing and exception handling Yes No No Availability of LINQ syntax Yes No No Combining list data from different SharePoint web applications Yes No Yes Familiarity to experienced REST/OData developers No No Yes Similarity to non-Windows programming or JavaScript programming No Yes Yes Strong typing for list item fields No (except with LINQ) No Yes, from Windows platform No, from JavaScript Leveraging jQuery, Knockout, and other JavaScript libraries No Yes No, from Windows platform Yes, from JavaScript  WCF Data Services Framework  If you prefer to use LINQ syntax in .NET Framework or Silverlight client applications, SharePoint 2013 supports WCF Data Services as a LINQ provider.  You can target either the listdata.svc (for list data only), or you can target the same client.svc that supports the OData interface for access to all SharePoint entities in addition to list data.   Deprecated API sets 1. ASP.NET (asmx) web services. 2. Direct Remote Procedure Calls (RPC) calls to the owssvr.dll file.
  • 24. Chapter 3—4 of 10 Create and use indexed columns Enforcing Uniqueness in Column Values by two ways: a. Primary key identity (ID). b. Unique column constraints feature. Defining "Unique"  SharePoint Foundation evaluates column values and determines uniqueness based on its evaluation of the values present in the column. For the evaluation, SharePoint Foundation uses the sort order of the site (the SPWeb) to do uniqueness case-insensitive comparisons. Supporting Unique Column Constraints  The key factor in determining whether a column supports uniqueness constraints is whether that column can be indexed.  Furthermore, when uniqueness is enforced on a Lookup column, uniqueness is not enforced on the projected column of the target list but rather on the ID column.  Column types that support the ability to be indexed ...> Unique:  Single line of text.  Choice field (but not multichoice).  Number.  Currency.  Column types that dont support the ability to be indexed:  Multiple lines of text.  Hyperlink/Picture.  Custom Field Types.  Calculated Field.  Boolean (yes/no).  Modified by. Indexing a Column with Unique Constraints  After a column has been set to enforce uniqueness, indexing cannot be turned off for that column. However, you can turn off indexing for that column if you first disable enforcement of uniqueness constraints. Setting Unique Constraints Programmatically  public bool EnforceUniqueValues { get; set; } //Gets or sets a Boolean value that specifies whether to enforce uniqueness in column values. The default is false.  You cannot set this property to true for a built-in field or for a site column.  When you set this property to true, you should Firstly set the Indexed property to true. Error Causes – Exceptions: 1) EnforceUniqueValues = true is set on a non-indexed field. Message reading "The field must first be indexed to enforce unique values." 2) EnforceUniqueValues = true is set on a list that has existing duplicate values. Message reading "This field contains duplicate values. Remove all duplicate values and try the operation again”. Content Migration and Unique Column Constraints  Content migration by using APIs support all types: i. partial (selective) migrations:  Merge files from the source site collection with files on the target  Automatically account for uniqueness states ii. full site collection migrations. by using export/import functions  you must ensure that if the uniqueness property is set on the list field on the export source, then the setting must be persisted on the import target. Copy-To and Move-To Operations with Column Constraints  Special considerations come into play whenever you copy or move items to a document library that is enforcing unique column constraints and you use the CopyTo(String)and MoveTo(String) methods on the SPFile class
  • 25. Chapter 3—5 of 10 Copy To operation Move To operation Within Same Doc Library Checks for uniqueness violations at the document level. Does not check across library folders. Moves without checking. Across Doc Libraries Converts values to null. Blocks the move if the destination list has enforced unique values. Out of Doc Library No effect. No effect. Into Doc Library Convert values to null. Convert values to null. Use Object Model Overrides SPQuery.QueryThrottleMode property  //Gets or sets a value that indicates the throttling mode to be applied to the query.  public SPQueryThrottleOption QueryThrottleMode { get; set; }  Throttling is applied based on user role and permissions. SPWebApplication.AllowOMCodeOverrideThrottleSettings property  //Indicates whether custom object model code can override the throttle settings.  public bool AllowOMCodeOverrideThrottleSettings { get; set; }  true if custom code can override throttle settings; otherwise, false.  SecurityException: The current user is not a farm administrator. SPList.EnableThrottling property // is bad  //Indicates whether throttling for this list is enabled or not.  public bool EnableThrottling { get; set; }  A Boolean indicating throttling status. A value of true throttling is enabled while false indicates otherwise.  Farm admin can set it to FALSE to make this list exception for throttle feature if it is set to false, then this list will not be throttled. Use Content Iterator  Writing Efficient Code in SharePoint Server  how to make the SharePoint object model work efficiently (performance, extensibility, and scalability)  Using SPQuery Objects:  Well-designed queries can help you avoid performance problems that can occur over time as the size of your site's lists and folders increases. 1) Use a bounded SPQuery object:  Specify a RowLimit between 1 and 2000 and page through the list if necessary. 2) Limit the result set:  Set the query threshold to limit the result default is 5,000 items, 3) Use indexed fields:  SetSPQuery.RowLimit to a value that is less than or equal to the threshold value. 4) Ensure you include one of the three OrderBy:  OrderByID, OrderByPath, or OrderByNVPField.  Used whenever the query is not designed to be restrictive enough to return fewer than the maximum number of items using previous techniques .  Using PortalSiteMapProvider:  PortalSiteMapProvider provides an automatic caching infrastructure for retrieving list data. The GetCachedListItemsByQuery method of PortalSiteMapProvider takes an SPQuery object as a parameter, and then checks its cache to determine whether the items already exist. If they do, the method returns the cached results. If not, it queries the list and stores the results in a cache.
  • 26. Chapter 3—6 of 10  This approach works especially well when you are retrieving list data that does not change significantly over time.  Limitation of PortalSiteMapProvider: a) Collection object cache that store data has a default size of 100 MB. You can increase the size of this cache for each site collection on the object cache settings page for the site collection. This memory, however, is taken from the shared memory available to the application pool and can therefore affect the performance of other applications. b) Cannot use it in applications based on Windows Forms. Implement cross-site queries SPSiteDataQuery class Represents a query that can be performed across multiple lists in multiple Web sites in the same Web site Collection public sealed class SPSiteDataQuery Specify the scope of the query by setting the Webs property. Specify the lists to participate in the query by setting the Lists property and the fields to return by setting the ViewFields property. Control data selection and order by setting the Query property in the same Collection. pass the SPSiteDataQuery object to the GetSiteData(SPSiteDataQuery) method, which returns a DataTable object containing rows of data that represent the result of the query. Access data contained in SharePoint Access data using server-side object model  Working with List Objects and Collections:  Objects  Collections [ count, add, delete]  Indexers Access data using client-side object model (CSOM) Data Retrieval Overview  You can use the new client object model to retrieve properties for a specific SharePoint client object, or to retrieve child items in a collection. The client object models do not persist data that is retrieved locally on the client. Performing data retrieval involves the following procedure: 1. Return the context for a client request by using the (JavaScript: ClientContext(serverRelativeUrl)). 2. Use the object model to specify an object to retrieve or from which to retrieve data. 3. Load the object or collection: a) load(clientObject)) :  In-place load.  Object identity is retained.  ClientContext.Load(clientContext.Web.Lists); b) loadQuery(clientObjectCollection, exp)  Queryable load.  Query is separate from the returned results.  Two steps defining the query expression, retrieving the query result.  Object identity is not retained, so your code must itself maintain.  var query = from list in clientContext.Web.Lists select list;  var result = clientContext.LoadQuery(query); 4. Execute the query by calling the: i. ExecuteQuery() method in the .NET or Silverlight version. ........> SYNC ii. ExecuteQueryAsync(SucceededEventHandler, RequestFailedEventHandler) .....> ASYNC In the JS. 5. When the method call to execute the query returns (either synchronously or asynchronously), you can access the results of the query on the object from which you initiated the query.
  • 27. Chapter 3—7 of 10 Query syntax versus method syntax  Both forms of Language-Integrated Query (LINQ) syntax--query syntax and method syntax [lambda expressions].  Three points to keep in mind when using LINQ to query against the client object model: 1) you are using LINQ to Objects, not the LINQ to SharePoint provider. 2) When your query is designed to return a subset of items from a list, it is more efficient to use a CAML query than a LINQ query. This is because With a CAML query, the filtering is done on the database server. 3) Returning a subset of the lists from a web site, LINQ are more efficient. Using query strings in ECMAScript  The JavaScript methods for retrieving objects and data do not accept LINQ syntax, but you can use a string expression to define a basic query.  Ex: clientContext.load(collList, 'Include(Title, Id)'); How to retrieve objects When list object is loaded in place, all default properties of the list can be accessed. How to update objects  Both Client object model and Server object model modification require calling update() method however,  Client object model, changes do not take effect until the object is loaded and ExecuteQuery() or ExecuteQueryAsync(ClientRequestSucceededEventHandler, ClientRequestFailedEventHandler) How to retrieve list items  it's most efficient to use a query in CAML use this method GetItems(CamlQuery) method How to update list items  To modify a list item you can specify the column value to change through an indexer, and just as for other objects, call Update() (JavaScript: update()) before calling ExecuteQuery() or ExecuteQueryAsync(Sucess,Failure).  ListItem oItem = oList.GetItemById(5); Asynchronous Processing Both the JavaScript version of the object model and the Silverlight version:  Asynchronous processing when it modifies the (UI).  Current() property when Specify the current request context. Access data using out-of-the-box Web Services  The Web services include methods for accessing content on a Web site [lists or document workspaces, or search].  Whenever possible, it is recommended that you use the new client-side object model to work remotely with SharePoint Foundation data, instead of using the legacy ASP.NET Web services.  SharePoint Foundation does not require the implementation of a particular version of SOAP. The SOAP response in any transaction with SharePoint Foundation is managed by the .NET Framework. Access data using REST API  Use OData query string operations to select, filter, and order the data you request from the SharePoint REST service.:  Select fields to return  Use the $select query option to specify which fields to return for a given list, list item, or other SharePoint object represented by an entity set. You can use $select=* to return all available fields.  If you do not specify the $select query option, the REST service returns all available fields by default.  Request can returns projected fields from other lists and the values of lookups. To do this, specify the field name in both the $select and $expand query options. For example: http://server/site/_api/web/lists('guid')/items?$select=Title,Products/Name&$expand=Products/Name  Bulk expansion and selection of related items is not supported.  Select items to return  Use the $filter query option to select which items to return. OData query operators supported in the SharePoint REST service lists the filter query comparison options and functions you can use with the SharePoint REST service.  Query for single value lookup fields
  • 28. Chapter 3—8 of 10  Single value lookup fields are represented by two separate fields in the SharePoint REST service: one field representing the actual field value, and another representing the field name.  queries against the lookup field value as you would any other fields  Query for users  In the SharePoint REST service, users are represented by the user's friendly (display) name so construct user queries against users' friendly names.  Membership-based user queries are not supported.  Usage of the Current operator to do queries using the ID of the current user is not supported.  Query for multi-value lookup fields and users  Because multi-value lookup fields are returned as a string of multiple values, there is no way to query for them (for example, the equivalent of an Includes element or NotIncludes element is not supported).  Sort returned items  Use the $orderby query option to specify how to sort the items in your query return set.  To sort by multiple fields, specify a comma-separated list of fields.  Ascending or descending order by appending the asc or desc keyword to your query.  Page through returned items  Use the $top and $skip query options to select a subset of the items that would otherwise be returned by your query.  The $top option enables you to select the first n items of the return set for return  http://server/site/_api/web/lists('<guid>')/items$top=10  The $skip option enables you to skip over the specified number of items and return the rest.  When using these query options, take into account that paging in OData is ordinal.  OData query operators supported in the SharePoint REST service
  • 29. Chapter 3—9 of 10 Access data using a custom (WCF) service to facilitate integration with an existing application:  You can create a custom web service that uses the server object model to access data.Gfg  SharePoint supports creation of both Microsoft ASP.NET and WCF custom web services, which can be used to develop SOAP-style or RESTful web services.  Although an ASP.NET web service has simpler configuration requirements, a WCF service provides more flexible, powerful bindings that are important for advanced applications.  A WCF web service can be more complicated, because its architecture requires you to specify complete configuration of the WCF service endpoints. This configuration information includes endpoint addresses, a service contract, and a binding configuration  Because this kind of configuration information cannot be provided in a static form, a web.config type of configuration cannot be used. The solution is dynamic configuration, or in WCF terms, programmatic configuration.  At run time, the SharePoint Foundation service factory configures the appropriate endpoints for your service automatically.  Creating and Implementing a Custom WCF Service:
  • 30. Chapter 3—10 of 10  Important When a web application is configured to use claims authentication, the (IIS) website is always configured to have anonymous access turned on. Your custom SOAP and WCF endpoints may receive requests from anonymous users If you have code in your WCF service that calls the RunWithElevatedPrivileges method. Store configuration data Implement web.config:  use the SPWebConfigModification class which allows you to dynamically register entities, The changes become effective when theSPWebService.ApplyWebConfigModifications method is called. o SPWebService service = SPWebService.ContentService; o SPWebConfigModification myModification = new SPWebConfigModification(); o myModification.Path ,name, sequence, type, value o service.WebConfigModifications.Add(myModification); o service.Update(); o service.ApplyWebConfigModifications();  Removing Configuration Settings:  modsCollection.Remove(configModFound); Implement a hierarchical data store &implement a property bag, implement SharePoint List: Managing Application Configuration: Configuration data is data that controls the program's logic instead of data that controls the business or user logic. An example of configuration data is a :  Connection string to a database  Storage options that SharePoint provides for other types of data Property Bag Schema:  An elements manifest can define a property bag for a file, folder, list item, or website.  The following is a list of the elements in the Property Bag schema.  <Elements>  <PropertyBag>  <Property> Implement credential storage:
  • 31. Chapter 4—1 of 10 Chapter 4 Implement SharePoint solutions (15‒20%) Manage SharePoint Object Life Cycle Implement Object Life Cycle management for SP Objects [SPWeb, ,SPSite]:  Best Practices: Using Disposable Windows SharePoint Services Objects to avoid retaining the objects in memory in the Microsoft .NET Framework.  Introduction : o Why Dispose?  Several of the Windows SharePoint Services objects, primarily the SPSite class and SPWeb class are lage in memory and make pressure on the garbage collector, which does not release the object from memory in a timely manner, so  You should not rely on the garbage collector to release them from memory automatically.  Finding Incorrectly Disposed Objects:  To identify the code that causes the problem, you can search in the logs for entries that contain the allocation identifiers  Coding Techniques to Ensure Object Disposal: a) Dispose method. b) using clause. c) try, catch, and finally blocks.  SPSite Objects  You should dispose of any SPSite object returned from the SPSiteCollection.Add method.  SPWeb Objects o The dispose cleanup is handled automatically by the SharePoint framework.  Other Objects That Require Disposal  Use SharePoint Dispose Checker Tool. Implement Object Life Cycle management for SPContext:  You don’t need to dispose objects coming from the SPContext but if you create child objectfrom it dispose the child object ex: SPContext.Current.Site.OpenWeb().Dispose() Implement Object Life Cycle management with Windows PowerShell: o Start-SPAssignment –global o $w = Get-SPWeb http://MyWeb o $w | Set-SPWeb –title "Accounting"Stop-SPAssignment –global o $gc = Start-SPAssignment o $web = $gc | Get-SPWeb http://MyWeb o $web | Set-SPWeb –title "Accounting"Stop-SPAssignment –Identity $gc Upgrade solutions and features Implement versioning of features and solutions  Every Feature has a version number that is specified in the corresponding Feature.xml file.  when you deploy a new version of a Feature, SharePoint Foundation detects that the associated Feature instance also needs an upgrade because the instance version number is lower than the new version number specified in the current Feature.xml file.  We can make use of Version attribute on the Feature element in SharePoint Upgrade features and solutions
  • 32. Chapter 4—2 of 10  SHAREPOINT 2010 FARM SOLUTIONS WILL RUN ON 2013 If you take a SharePoint 2010 farm solution (as a WSP) and install it into 2013  Upgrade Steps: a) SUPPORT MULTIPLE VERSIONS IN ONE VISUAL STUDIO SOLUTION b) CHANGE THE VERSION OF YOUR SOLUTION PACKAGE TO '15.0' c) WHO MOVED THE GAC? d) SPUTILITY.GETGENERICSETUPPATH METHOD IS OBSOLETE e) THE _LAYOUTS VIRTUAL DIRECTORY NOW HAS A SNEAKY "15" IN IT  Upgrading Features: Microsoft SharePoint Foundation provides new members that make it possible for you to upgrade custom Features through versioning and declarative upgrade actions: I. Define upgrade definitions for new Feature versions. II. Provision a list instance as part of a Feature upgrade. III. Create separate upgrade action sets, based on the Feature version, that remove different sets of files. IV. Apply settings to site collections where a particular Feature is activated.  SPSite, SPWebApplication, SPWebService [.QueryFeatures(myScope, true)]  Feature.xml Changes  The new <UpgradeActions> section in a Feature.xml file specifies upgrade actions that you can apply to a specified Feature.  The <UpgradeActions> element can contain the following sub-elements:  <CustomUpgradeAction> — Allows you to execute custom code when a Feature instance is being upgraded. When an action is specified in an upgrade action sequence, Microsoft SharePoint Foundation calls the FeatureUpgrading(SPFeatureReceiverProperties, String, IDictionary<String, String>) method synchronously with other upgrade actions, in order of declaration.  <VersionRange> — Specifies a version range to which specified upgrade actions apply.  <ApplyElementManifests> — Adds a new element to an existing Feature. When a Feature is upgraded, provisions all non-declarative elements that are referenced in the specified element manifests.  <AddContentTypeField> — Adds a new field to an existing provisioned content type. Propagates the change from the site content type to all child lists and content types within the site.  Upgrading a Farm Solution in SharePoint There are two ways to upgrade a farm solution: Replacement: The old version of the solution is retracted, and optionally removed from the farm solution store. The new version is then added to the solution store and deployed. It is not necessary that the new solution package (.wsp file) have the same name or GUID as the old version, however, if the old version is retracted but not removed from the solution store, then the new version must have a different filename and GUID. This kind of upgrade must be used if the new version of the solution differs from the installed version in any of the following ways The new version: a) Removes a Feature that was in the old version or adds a Feature that was not in the old version. b) Changes the ID of a Feature. c) Changes the scope of a Feature. d) Changed version of a Feature Receiver. e) Adds a new elements.xml file, removes an elements.xml file, or changes the contents of an existing elements.xml file. f) Adds a new Property element to a Feature.xml file, removes a Property element from a Feature.xml file or changes the value of a Property element in a Feature.xml file. Update:  A new version of the solution package is installed and deployed which has a different file name but the same GUID as the old version.  the GUIDs are the same, SP automatically retracts the old version before deploying the new version.
  • 33. Chapter 4—3 of 10  If there are Features in the solution, then the new and old versions have the same set of Features and they remain activated but assemblies and certain other files in them are updated with the versions from the new solution package.  Each time a solution is successfully upgraded, the previous version of the solution is backed up and stored in the configuration store.  This backup is used by the solution framework in the case of an upgrade failure. Only a single backup copy is stored per solution.  Farm administrators perform an update type of upgrade with the Update-SPSolution command in SharePoint Management Shell. Implement assembly versioning & Build components for in-process request routing  One of the nice features of Sharepoint 2010 is the automatic assemblies redirect which allows to use old code which was written and compiled for Sharepoint 2007 also in Sharepoint 2010. It is achieved by assemblies redirects in web.config. Determine a solution structure Select feature scope and visibility. Elements by Scope Define feature dependencies.  Activation Dependencies and Scope: Expresses a requirement in the relationship between two Features. when a Feature at a particular scope has a dependency on another Feature . Why using activation dependencies?? a) Feature grouping concepts: When one Feature is activated, other Features can also be activated or When you deactivate the Feature, the dependent Features are deactivated if no other Features depend on them. b) Feature resource guarantees: You may need Web site-scoped Feature to contain an implementation. You can use an activation dependency to ensure that both Features are activated. Activation Dependency Rules:  Activation dependencies must applied by certain rules to avoid, Circular dependencies, dependency chains that limit performance. 1. Same-Scope Rules:  If a Feature is dependent on another Feature at the same scope, and the second Feature is not activated when the first one is activated, Microsoft SharePoint Foundation activates the second Feature.  If a Feature is deactivated, SharePoint Foundation deactivates a same-scope dependent hidden Feature when the last visible Feature that dependet on that hidden Feature is deactivated. 2. Cross-Scope Rules:  Cross-scope activation dependencies are not supported if the Feature depended upon: i. is at a more restrictive scope. Ex: a site collection–scoped Feature, Web site–scoped Feature. ii. is not visible in the user interface. iii. is not activated, activation of the depending Feature fails. 3. General Rules:  Dependencies can work only one level deep. In other words, dependency chains are not supported. does support more than one level in activation dependencies.  You can target an activation dependency against hidden or visible Features, but hidden Features cannot have activation dependencies.
  • 34. Chapter 4—4 of 10  When more than one Feature has a dependency on a given Feature, keep in mind the danger of leaving one of the depending Features without the required Feature dependencies. For example, B=>A A=>C .. deactiv B=> deactiv A but C is still activated <ActivationDependencies> <ActivationDependency FeatureId="11111111-1111-1111-1111-111111111111" /> </ActivationDependencies> Define solution dependencies. When you deploy a solution with an activation dependency, SharePoint will check if this parent solution is already deployed. If not, you will get an error message. Solution dependencies must be defined in the solution manifest, i.e. the manifest.xml file in your wsp package. Organize SharePoint project items. Packaging and Deploying SharePoint Solutions:  Creating Features and Packages: I. Visual Studio II. SharePoint solution package (.wsp) to bundle multiple features, site definitions and assemblies.  Feature and Packaging Tool Support: A. Feature Designer and Package Designer. B. Packaging Explorer, a tool window. C. Solution Explorer.  Deploying SharePoint Solutions: After you customize the Features and package in Visual Studio, you can create a .wsp file to deploy to SharePoint servers. You can use Visual Studio to debug and test the .wsp only on the SharePoint server on the development computer. Deploying Files in SharePoint Solutions: For example, to add an no compiled file (.xml file) to a SharePoint project: 1) Add a SharePoint "Layouts" Mapped Folder to your project. Add the .xml file to the new subfolder. By default, the file is deployed to the SharePoint file system under ..TEMPLATELAYOUTSFolder Name. 2) Add the .xml file to the folder of a SharePoint project item, and then change the Deployment Type property of the .xml file from NoDeployment to another setting such as RootFile or ElementFile. 3) If an added file does not apply to any specific project in the solution, you can add an Empty SharePoint Project to your solution and then add the additional files to it. Another alternative for deploying files to SharePoint, especially to the content database, is to add a module to the project and then add the files to the module. Create sandbox solutions Scope features to constraint Only Features scoped to the site collection or the website are possible in sandboxed solutions.Farm and web application scope are not possible. Site collection features are activatedautomatically when the solution activated Restrictions on Sandboxed Solutions: a) Triple Worker Processes. b) Low-Privileged Security Token for the Sandboxed Worker Process. c) Restrictive Code Access Security Policy for the Sandboxed Worker Process. d) Special Versions of the Microsoft.SharePoint.dll Assembly.
  • 35. Chapter 4—5 of 10 e) Split Page Rendering System. f) Resource Usage Limitations. g) Farm-Relative Validation of Solutions. h) Farm-Relative Blocking of Solutions. i) Farm-Relative Blocking of Classes. Identify SharePoint artifacts that can be used in sandbox: What Can Be Implemented in Sandboxed Solutions: I. Assembly Refers to assemblies whose source code is part of the Microsoft Visual Studio sandboxed solution project. Non-SharePoint assemblies cannot be deployed in a sandboxed solution. II. Binding of content type to a list III. Content type IV. Custom action for a menu, the ribbon, or an administration page V. Feature VI. Only Features scoped to the site collection or the website are possible in sandboxed solutions. Farm and web application scope are not possible. VII. List/library instance VIII. Site page, including both master page and content page Application pages cannot be included in a sandboxed solution. IX. Web Part Only Web Parts derived from System.Web.UI.WebControls.WebParts.WebPart can be used in a sandboxed solution. Web Part connections are not possible in sandboxed solutions. X. Web template A web template is deployed as a WebTemplate element along with an onet.xml file and optionally a default.aspx file. A web template is functionally equivalent to a site definition configuration. Site definition configurations cannot be deployed in a sandboxed solution. Access data outside of sandbox scope: Sandboxed Solutions in Partnership with Full-Trust Proxies Several ways that sandboxed solutions can escape the usual restrictions on what they can access:  Full-trust proxy operations: Create a special kind of operation that runs in a full trust process, but that can be called from a sandboxed solution. The operation is deployed as a farm solution by a farm administrator who trusts it and is prepared to let sandboxed solutions call it, this technique cannot be used when farm deployment is not an option, such as “SharePoint Online”.  using client object model code to access resources that are not otherwise available to sandboxed solutions.
  • 36. Chapter 4—6 of 10 Sandbox solution deployment, Upgrade sandbox solutions:  Installing a Sandboxed Solution: Just as with a farm solution, there are two steps to installing a sandboxed solution, uploading and activating. a) Upload stage: The upload stage consists of uploading a sandboxed solution to the solution gallery of a site collection. This parallels adding a farm solution. b) Activation stage: The activation stage occurs after the solution is uploaded to a solution gallery. Activating the solution makes it operate within the site by deploying files, registering event receivers, and running solution validation. This parallels deploying a farm solution. 1. A sandboxed solution is installed by a site collection administrator to the site collection's solution gallery. The following steps: 1) Click Site Actions, and then select Site Settings. 2) Click Solutions under the Galleries heading. 3) Click Upload Solution from ribbon. 4) Browse to the sandboxed solution package (.wsp file). Click Open. 5) In the Activate Solution dialog box, click Activate to activate the solution. o If the sandboxed solution package contains a Feature it is activated automatically. o When you add a sandboxed solution package through the object model, both site collection–scoped and website-scoped Features must be activated on the Manage site features page 2. SharePoint Management Shell (Windows PowerShell). The commands are Add-SPUserSolution and Install- SPUserSolution. 3. Microsoft Visual Studio, you can perform all installation steps by selecting Deploy Solution on the Build menu.  Uninstalling a Sandboxed Solution 1. There are also two steps to uninstalling a sandboxed solution.
  • 37. Chapter 4—7 of 10 A. Deactivation stage: from the site collection's solution gallery. Which reverses previous actions B. Deletion stage: from the solution gallery. A sandboxed solution cannot be deleted if it is still activated. When a sandboxed solution is deleted, it is moved into the Recycle Bin and can be restored or deleted permanently from the Recycle Bin. 2. using SharePoint Management Shell (Windows PowerShell). The commands are Uninstall- SPUserSolution and Remove-SPUserSolution. 3. On your development computer, in Visual Studio, you can perform all uninstallation steps by selecting Retract Solution on the Build menu.  Upgrading a Sandboxed Solution 1. Installing a new sandboxed solution package (.wsp file) that has the same solution ID as the existing sandboxed solution but a different hash code. 2. using SharePoint Management Shell (Windows PowerShell). The command is Update-SPUserSolution (not Upgrade-SPUserSolution). Implement custom solutions validators: Validate Sandboxed Solutions using SPSolutionValidator: What will happen? If you have a custom Solution Validator hooked up with your farm, a custom error page will be displayed, and the solution will not be activated. Building a Solution Validator we need: A Solution Validator A feature to install/uninstall the validator in our Farm Summary and reflections:  If you want to create some kind of check to automatically validate solution that are uploaded by end-users in their Solution Galleries, this is the way to do it.  Solution validators are very easy to write, and they can be installed using a few different approaches. My take is to create a farm feature, while you could still do it using powershell or in any way you want through the object model. Create a no-code solution Configure no-code customizations for the SharePoint 2013 platformCreate XSLT for web parts  Create SharePoint 2013 no-code solutions I. What is a SharePoint Composite?  A SharePoint Composite is a no-code, do-it-yourself business solution that you can create quickly by assembling, connecting, and configuring the basic building blocks of functionality available in SharePoint 2013 and Office 2013. A SharePoint Composite combines data, documents, and business processes in a useful, productive way.  Or a web application that you can use to incorporate data quickly into a simple, visual, and interactive solution. A SharePoint Composite can be:  As simple as a custom webpage that uses a site list and several connected Web Parts.  As sophisticated as a system that’s connected to a database by using Business Connectivity Services (BCS). II. How-tos for creating no-code solutions?
  • 38. Chapter 4—8 of 10 A. Using SharePoint 2013 Composites: Provides links to many practical articles, walkthroughs, demos, virtual labs, and other formats that show how to create no-code solutions. B. Save, download, and upload a SharePoint 2013 site as a template: Explains how to create site templates without using code so you can easily deploy no-code solutions.  Design Manager in SharePoint 2013:  Get an overview of using Design Manager to brand your SharePoint 2013 site.  The designer will perform the following tasks: 1. Understand core SharePoint design concepts. 2. Create a mock-up of the design in HTML and CSS. 3. Implement the design by using Design Manager. I. Use Design Manager to implement a design: "design" is simply a group of files that implement:  At least one HTML file that will be converted into a SharePoint master page.  One or more CSS files.  JavaScript files.  Images.  Other supporting files. Create and upload JavaScript files Uploading JavaScript (JS Files) as Javascript Display Template: While working with SharePoint there is a common requirement to Upload JavaScript Files that you want to use in one of your WebParts or with the new JS Link property of a List,Field,Form or a WebPart in your SharePoint 2013 site. You can either upload these .js files in: I. The Styles, or II. Site Asserts Library ,or III. you can add it to the Master Page Gallery as a new JavaScript Display Template. 1) Navigate to the Master Page Gallery (Site Settings -> under Web Designer Galleries -> Master Pages). 2) Select Files tab and then Upload Document. 3) Browse to the new JavaScript file that you have created and select Ok. 4) Next select “JavaScript Display Template” in the Content Type drop-down. 5) Next specify the Name, Title, Description properties along with some other properties