what is oAuth and how it works?
OAuth is not the protocol for authenticating users to access
SharePoint. It would still be done by Claims Authentication. The OAuth comes
into picture when we want to authenticate and authorize SharePoint 2013 Apps.
Step 1 –> The user accesses the SharePoint 2013 portal
and SharePoint 2013 authenticates the user using Claims Authentication
Step 2 –> SharePoint 2013 requests for the Context
Token for the user, from Windows Azure ACS (Access Control Services)
Step 3 –> ACS returns Context Token
Step 4 –> SharePoint 2013 passes the Context Token to the
user
Step 5 –> User accesses App using Context Token
Step 6 –> Client App pulls Refresh Token from the Context
Token and requests ACS for oAuthToken
Step 7 –> ACS server returns OAuth token to the client
app
Step 8 –> Client App makes CSOM/REST calls to SharePoint
site by passing OAuth Token
Step 9 –> SharePoint 2013 returns site content to App
based on the App Permission Manifests
Step 10 –> Client App returns the App Content to the user
SharePoint-hosted and provider-hosted
A SharePoint Add-in is a self-contained piece of
functionality that extends the capabilities of SharePoint websites to solve a
well-defined business problem.
The SharePoint websites where SharePoint Add-ins are
installed, and from which users launch them, are called host webs. The
SharePoint components, however, are generally in a special child web of the
host web called the add-in web.
A SharePoint Add-in is configured using an add-in
manifest—an XML file that declares the add-in's basic properties, where it
runs, and what SharePoint should do when the add-in starts. Among other things,
the manifest can specify what languages the add-in supports, what SharePoint
services and functionality it depends on, and the permissions to the host web
that the add-in needs. (SharePoint Add-ins have full control of their own
add-in web.)
You distribute SharePoint Add-ins in add-in packages that
always include at least the add-in manifest. (If there are no SharePoint
components, the add-in manifest may be the only thing in the add-in package.)
If the add-in has SharePoint components in an add-in web, these are included in
the package as a set of XML files. Remote components that are hosted outside of
SharePoint, such as a remote web application or database, are not included in
the package and are deployed separately from the add-in package. (However, the
add-in manifest does specify the URLs of the remote components.)
You can distribute an add-in package in two ways:
-To an organization's add-in catalog
-To the Office Store
SharePoint Hosted Add-in -
All business logic in a SharePoint-hosted add-in uses
JavaScript, either directly on a custom page or in a JavaScript file that is
referenced from a custom page. A JavaScript version of the SharePoint object
model (JSOM) is available to make it simple for the add-in to perform CRUD
(create, read, update, and delete) operations on SharePoint data.
Everything else in a SharePoint-hosted add-in is deployed to
the add-in web.
The JavaScript in SharePoint-hosted add-ins can access data
and resources that are outside of the add-in web by using either of two
techniques for safely working around the browser's same origin policy: a
special JavaScript cross-domain library or a specific JavaScript WebProxy
class. Using these techniques, a SharePoint-hosted add-in can work with data on
the host web, its parent subscription, or anywhere on the Internet.
Provider Hosted Add-in -
Any SharePoint component that can be in a SharePoint-hosted
add-in can also be in a provider-hosted add-in. But provider-hosted add-ins are
distinguished from SharePoint-hosted add-ins because they include at least one
remote component, such as a web application, service, or database, that is
hosted externally from the SharePoint farm or SharePoint Online subscription. This
could be a server in the same corporate network as a SharePoint farm or a cloud
service.
Provider-hosted add-ins can connect to any internal or
public web service and, unlike SharePoint-hosted add-ins, they can handle
SharePoint list and list item events, such as adding an item to a document
library.
What is host-web and app-web?
What are Web-Jobs?
-------------------------
REST API, GET, POST, PUT and DELETE
One advantage of using REST is that you don't have to add
references to any SharePoint libraries or the client assemblies. Instead, you
make HTTP requests to the appropriate endpoints to retrieve or update
SharePoint entities, such as Webs, lists and list items.
/_api/Web/Lists
/_api/Web/Lists/GetByTitle('listname')
/_api/Web/Lists(guid'guid id of your list')
/_api/Web/Lists/GetByTitle(' listname ')/Fields
/_api/Web/Lists/GetByTitle('listname')/Fields/GetByTitle('fieldname')
/_api/web/lists/GetByTitle('listname')/GetItemById(itemId)
/_api/Web/Lists/GetByTitle('listname')/Items
"/_api/web/lists/getByTitle('LicensingInformation')/items?$select=ID,CompanyName0/Id,CompanyName0/Company_x0020_Name"
"/_api/web/lists/getByTitle('LicensingInformation')/items?$top=1&$orderby=Id%20desc"
-------------------------
OOPS Concepts
Encapsulation binds together code and the data it
manipulates and keeps them both safe from outside interference and misuse.
Encapsulation is a protective container that prevents code and data from being
accessed by other code defined outside the container.
Inheritance is the process by which one object acquires the
properties of another object. A type derives from a base type, taking all the
base type members fields and functions. Inheritance is most useful when you
need to add functionality to an existing type.
Classes are special kinds of templates from which you can
create objects. Each object contains data and methods to manipulate and access
that data. The class defines the data and the functionality that each object of
that class can contain.
public-
Public class is visible in the current and referencing assembly.
private-
Visible inside current class.
protected-
Visible inside current and derived class.
Internal-
Visible inside containing assembly.
Internal
protected- Visible inside
containing assembly and descendent of thecurrent class.
sealed-
Class can't be inherited by a derived class.
static-
Class contains only static members.
unsafe-
The class that has some unsafe construct likes pointers.
Abstract-
The instance of the class is not created if the Class is abstract.
The partial keywords allow a class to span multiple source
files. When compiled, the elements of the partial types are combined into a
single assembly.
A static class is declared using the "static"
keyword. If the class is declared as static then the compiler never creates an
instance of the class. All the member fields, properties and functions must be
declared as static and they are accessed by the class name directly not by a
class instance object.
Function overloading allows multiple implementations of the
same function in a class. Overloaded methods share the same name but have a
unique signature. The number of parameters, types of parameters or both must be
different. A function can't be overloaded on the basis of a different return
type alone.
By declaring a base class function as virtual, you allow the
function to be overridden in any derived class. The idea behind a virtual
function is to redefine the implementation of the base class method in the
derived class as required. If a method is virtual in the base class then we
have to provide the override keyword in the derived class. Neither member
fields nor static functions can be declared as virtual.
C# allows both classes and functions to be declared abstract
using the abstract keyword. You can't create an instance of an abstract class.
An abstract member has a signature but no function body and they must be
overridden in any non-abstract derived class. Abstract classes exist primarily
for inheritance. Member functions, properties and indexers can be abstract. A
class with one or more abstract members must be abstract as well. Static
members can't be abstract.
EX:
using System;
namespace oops
{
//abstract class
public abstract class
Employess
{
//abstract
method with no implementation
public
abstract void displayData();
}
//derived class
public class test : Employess
{
//abstract
class method implementation
public
override void displayData()
{
Console.WriteLine("Abstract
class method");
}
}
class abstractClass
{
static void
Main(string[] args)
{
//
class instance
new
test().displayData();
}
}
}
Sealed classes are the reverse of abstract classes. While
abstract classes are inherited and are refined in the derived class, sealed
classes cannot be inherited. You can create an instance of a sealed class. A
sealed class is used to prevent further refinement through inheritance.
EX:
using System;
namespace oops
{
sealed class SealedClass
{
void
myfunv();
}
public class test : SealedClass
//wrong. will give compilation error
{
}
}
An interface is a set of related functions that must be
implemented in a derived class. Members of an interface are implicitly public
and abstract. Interfaces are similar to abstract classes. First, both types
must be inherited; second, you cannot create an instance of either. Although
there are several differences as in the following;
An Abstract class can contain some implementations but an
interface can't.
An Interface can only inherit other interfaces but abstract
classes can inherit from other classes and interfaces.
An Abstract class can contain constructors and destructors
but an interface can't.
An Abstract class contains fields but interfaces don't.
EX:
using System;
namespace oops
{
// interface
public interface xyz
{
void
methodA();
void
methodB();
}
// interface method
implementation
class test : xyz
{
public void
methodA()
{
Console.WriteLine("methodA");
}
public void
methodB()
{
Console.WriteLine("methodB");
}
}
class interfaceDemo
{
static void
Main(string[] args)
{
test
obj = new test();
obj.methodA();
obj.methodB();
}
}
}
An interface can be inherited from other interfaces as in
the following:
EX:
public interface xyz
{
void methodA();
void methodB();
}
public interface abc : xyz
{
void methodC();
}
Polymorphism is the ability to treat the various objects in
the same manner. It is one of the significant benefits of inheritance. We can
decide the correct call at runtime based on the derived type of the base
reference. This is called late binding.
Static / Compile Time Polymorphism.
Dynamic / Runtime Polymorphism.
Static or Compile Time Polymorphism
It is also known as Early Binding. Method overloading is an
example of Static Polymorphism. In Overloading, the method / function has the
same name but different signatures. It is also known as Compile Time
Polymorphism because the decision of which method is to be called is made at
compile time.
Here the compiler checks the number of parameters passed and
the type of parameter and make the decision of which method to call and it
throw an error if no matching method is found
Dynamic / Runtime Polymorphism
Dynamic / runtime polymorphism is also known as late
binding. Here, the method name and the method signature (number of parameters and
parameter type must be the same and may have a different implementation).
Method overriding is an example of dynamic polymorphism.
Method overriding can be done using inheritance. With method
overriding it is possible for the base class and derived class to have the same
method name and same something. The compiler would not be aware of the method
available for overriding the functionality, so the compiler does not throw an
error at compile time. The compiler will decide which method to call at runtime
and if no method is found then it throws an error.
--------------------
Microsoft Graph API
Microsoft Graph is the gateway to data and intelligence in
Microsoft 365. Microsoft Graph provides a unified programmability model that
you can use to take advantage of the tremendous amount of data in Office 365,
Enterprise Mobility + Security, and Windows 10.
You can use the Microsoft Graph API to build apps for
organizations and consumers that interact with the data of millions of users.
With Microsoft Graph, you can connect to a wealth of resources, relationships,
and intelligence, all through a single endpoint: https://graph.microsoft.com.
Microsoft Graph exposes APIs for:
Azure Active Directory
Office 365 services: SharePoint, OneDrive, Outlook/Exchange,
Microsoft Teams, OneNote, Planner, and Excel
Enterprise Mobility and Security services: Identity Manager,
Intune, Advanced Threat Analytics, and Advanced Threat Protection.
Windows 10 services: activities and devices
Education
What can you do with Microsoft Graph?
You can use Microsoft Graph to build experiences around the
user's unique context to help them be more productive. Imagine an app that...
-Looks at your next meeting and helps you prepare for it by
providing profile information for attendees, including their job titles and who
they work with, as well as information about the latest documents and projects
they're working on.
-Scans your calendar, and suggests the best times for the
next team meeting.
-Fetches the latest sales projection chart from an Excel
file in your OneDrive and lets you update the forecast in real time, all from
your phone.
-Subscribes to changes in your calendar, sends you an alert
when you’re spending too much time in meetings, and provides recommendations
for the ones you can miss or delegate based on how relevant the attendees are
to you.
-Helps you sort out personal and work information on your
phone; for example, by categorizing pictures that should go to your personal
OneDrive and business receipts that should go to your OneDrive for Business.
You can do all this and more with the Microsoft Graph API.
SPFx
The SharePoint Framework (SPFx) is a page and web part model
that provides full support for client-side SharePoint development, easy
integration with SharePoint data, and support for open source tooling. With the
SharePoint Framework, you can use modern web technologies and tools in your
preferred development environment to build productive experiences and apps that
are responsive and mobile-ready from day one.
You can use any JavaScript framework that you like: React,
Handlebars, Knockout, Angular, and more.
The toolchain is based on common open source client
development tools such as npm, TypeScript, Yeoman, webpack, and gulp.
Office UI Fabric
The Office UI Fabric is the official front-end framework for
building experiences in Office 365 and SharePoint.
The goal of the SharePoint Framework is to allow both
Microsoft and customers to build rich, beautiful, and consistent user
experiences on top of SharePoint.
There are two parts of the Office UI Fabric that are
available for use by developers:
Office UI Fabric Core. A set of core styles, typography, a
responsive grid, animations, icons, and other fundamental building blocks of
the overall design language.
Office UI Fabric React. A set of React components built on
top of the Fabric design language for use in React-based projects.
PowerApps
Power Apps now supports creating an app from the data stored
in the lists on a SharePoint 2013 and SharePoint 2016 On-Premises site.
PowerApps is considered as a successor for custom forms and it is based on an
open source version of the software called Apache Cordova powered by Resources
from Azure app Service.
Microsoft is planning to enable embedding PowerApps directly
into SharePoint page, so that it can be viewed as a part of SharePoint page.
PowerApps allows you to easily create and share apps from
the existing data sets and no coding is necessary. These data sets include
Cloud-stored Excel files, SharePoint Lists and SQL Azure tables.
Flow
It allows you to automate business processes by building
workflows based on certain triggers and actions. For example, once a new entry
is added to the SharePoint list – an email can be sent asking an individual to
review. Or, maybe when a document is uploaded to the document library, an email
will be sent to your manager asking for an approval/feedback of the document.
SharePoint Designer is purely a SharePoint-specific tool.
However, its workflow capability does not allow for easy interface with other
applications. Also, creating a workflow in SharePoint Designer is not something
one can do on Day 1.
Microsoft Flow, on another hand, employs a graphical user
interface that allows building workflows almost the same way you would be
building them in Visio. What makes the Microsoft Flow unique is that your
workflow can interact with other applications like MailChimp, DropBox, Twitter,
SharePoint, and OneDrive.
Teams and Groups
Office 365 Groups is the cross-application membership
service in Office 365. At the basic level, an Office 365 Group is an object in
Azure Active Directory with a list of members and a loose coupling to related
workloads including a SharePoint team site, Yammer Group, shared Exchange
mailbox resources, Planner, PowerBI and OneNote. You can add or remove people
to the Group just as you would any other group-based security object in Active
Directory.
Authentication model
Office 365 uses the cloud-based user identity and
authentication service Azure Active Directory (Azure AD) to manage users.
Cloud-only
With the cloud-only model, you manage your user accounts in
Office 365 only. No on-premises servers are required; it's all handled in the
cloud by Azure AD.
Integrating your on-premises directories with Office 365 and
Azure AD has been simplified with Azure AD Connect. Azure AD Connect is the
best way to connect your directories and is Microsoft’s recommendation for
organizations to sync their users to the cloud.
--------------------------
Azure
Application Services
Azure Web Apps enables you to build and host web
applications in the programming language of your choice without managing
infrastructure. It offers auto-scaling and high availability, supports both
Windows and Linux, and enables automated deployments from GitHub, Visual Studio
Team Services, or any Git repo
Azure App Service Web Apps (or just Web Apps) is a service
for hosting web applications, REST APIs, and mobile back ends. You can develop
in your favorite language, be it .NET, .NET Core, Java, Ruby, Node.js, PHP, or
Python. Applications run and scale with ease on Windows-based environments.
Web Apps not only adds the power of Microsoft Azure to your
application, such as security, load balancing, autoscaling, and automated
management. You can also take advantage of its DevOps capabilities, such as
continuous deployment from VSTS, GitHub, Docker Hub, and other sources, package
management, staging environments, custom domain, and SSL certificates.
Why use Web Apps?
Multiple languages and frameworks
DevOps optimization
Global scale with high availability
Connections to SaaS platforms and on-premises data
Security and compliance
Application templates
Visual Studio integration
API and mobile features
Serverless code
Database Services
Service Fabric
Azure Service Fabric is a distributed systems platform that
makes it easy to package, deploy, and manage scalable and reliable
microservices and containers. Service Fabric also addresses the significant
challenges in developing and managing cloud native applications. Developers and
administrators can avoid complex infrastructure problems and focus on
implementing mission-critical, demanding workloads that are scalable, reliable,
and manageable.
Cognitive API
Build intelligent algorithms into apps, websites, and bots
so that they see, hear, speak, and understand your user needs through natural
methods of communication.
Microsoft Cognitive Services (formerly Project Oxford) are a
set of APIs, SDKs and services available to developers to make their applications
more intelligent, engaging and discoverable. Microsoft Cognitive Services
expands on Microsoft’s evolving portfolio of machine learning APIs and enables
developers to easily add intelligent features – such as emotion and video
detection; facial, speech and vision recognition; and speech and language
understanding – into their applications.
LogicApps
Azure Logic Apps simplifies how you build automated scalable
workflows that integrate apps and data across cloud services and on-premises
systems.
Azure Logic Apps provide a mechanism for application
integration and workflow definition in the cloud. It provides a visual designer
for configuring the workflows. You can define a workflow with connectors and
logic creation using inbuilt standard connectors and enterprise integration
connectors.
You do not have to worry about hosting, scalability,
availability and management. Logic Aps will scale up automatically to manage
demand.
It is a Serverless application.
By serverless it doesn't mean there are no servers, it just
means the developers do not have to worry about the underlying infrastructure.
------------------------------
MVC
Model: Model represents shape of the data and business
logic. It maintains the data of the application. Model objects retrieve and store
model state in a database.
Model is a data and business logic.
View: View is a user interface. View display data using
model to the user and also enables them to modify the data.
View is a User Interface.
Controller: Controller handles the user request. Typically,
user interact with View, which in-tern raises appropriate URL request, this
request will be handled by a controller. The controller renders the appropriate
view with the model data as a response.
Controller is a request handler.
MVC is popular as it isolates the application logic from the
user interface layer and supports separation of concerns. Here the Controller
receives all requests for the application and then works with the Model to
prepare any data needed by the View. The View then uses the data prepared by
the Controller to generate a final presentable response.
The MVC framework is defined in the System.Web.Mvc assembly.
The MVC pattern helps you create applications that separate
the different aspects of the application (input logic, business logic, and UI
logic), while providing a loose coupling between these elements. The pattern
specifies where each kind of logic should be located in the application. The UI
logic belongs in the view. Input logic belongs in the controller. Business
logic belongs in the model. This separation helps you manage complexity when
you build an application, because it enables you to focus on one aspect of the
implementation at a time. For example, you can focus on the view without
depending on the business logic.
The loose coupling between the three main components of an
MVC application also promotes parallel development. For example, one developer
can work on the view, a second developer can work on the controller logic, and
a third developer can focus on the business logic in the model.
1.) Model :-
This part represent the data and business logic of the
application.
This component focus on keeping track of the state of the
application.
This responsible to how data can be changed and manipulated.
2.) View :-
This provide the user interface (UI) of the web application.
This component is visible to end users who is accessing the
application.
View represent the UI components like html,css,xml,jquery
etc.
3.) Controller :-
The controller component receive the request via view. After
that pass this request to model for processing the user data.
The Model component pass the result back to controller.
The controller is responsible to pass the result to
the view.
The view display the result on your user interface.
Some Important point about MVC
MVC consists of three components model,view and controller.
The model and view created by the controller.
Dotted line indicates,view knows about model but model does
not know about any other components.
Request first comes to controller via view.after that it
pass the request to model for manipulation.
The helps to bind the model with view.
Here Logic is stored in controller.
MVVM (Model View ViewModel) :-
MVVM stands for Model View ViewModel. This support WPF
and SilverLight Patterns.This pattern supports two way data binding between
View and ViewModel .
Some Key points about MVVM Pattern:-
First user interact with view.
The view gets the user input and forwards it to the
ViewModel by using command.
This pattern support two way data binding between view and
view model.
The view knows the about ViewModel.
The ViewModel does not know about view.
The model does not know about ViewModel.
Many view can be mapped to one ViewModel.
It uses WPF and SilverLight Bindings.