Monday 20 November 2017

SharePoint On-Premises vs SharePoint Online interview questions and answers

JavaScript
JavaScript is a object-oriented computer programming language commonly used to create interactive effects within web browsers .      
JavaScript DOM
JavaScript can access and change all the elements of an HTML document. The HTML DOM (Document Object Model)
When a web page is loaded, the browser creates a Document Object Model of the page.
The HTML DOM model is constructed as a tree of Objects: <html><body><images>….etc.
·         HTML DOM methods are actions you can perform (on HTML Elements).
·         HTML DOM properties are values (of HTML Elements) that you can set or change.
JavaScript Advantages
·          Less server interaction
·          Immediate feedback to the visitors
·          Increased interactivity
·          Richer interfaces
JQuery
·         jQuery is a JavaScript Library
·         Download the jQuery library from jQuery.com or Add CDN link.
·         Selecting HTML elements and performing some action on the element(s)
like… $("#test").onclick, $(this).hide()
inside a document ready event.
$(document).ready(function(){
   
// jQuery methods go here...
});
Angular JS
Angular JS is a JavaScript-based open-source front-end web application framework.
The AngularJS framework works by first reading the HTML page. Which has additional custom tag attributes embedded into it. Work under Directives.
AngularJS Directives
AngularJS directives are extended HTML attributes with the prefix ng-.
The ng-app directive initializes an AngularJS application.
The ng-init directive initializes application data.
The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
ClientContext.load (items) in JSOM?
ClientContext - Retrieves the properties of a client object from the server.
Load()  -  Load is to prepare query. load method is inherited from the SP.ClientRuntimeContext object. 
ExecuteQuery() :- What you want from the server ExecuteQuery is to get the data from the server.

To be clear ExecuteQuery does not exist in the JavaScript version of the SharePoint client object model. You can only work asynchronously.

ClientContext.ExecutequeryAsync in JSOM?

What you want from the server ExecutequeryAsync is to get the data from the server

1.        The executeQueryAsync method is inherited from the SP.ClientRuntimeContext object. 
2.        It will execute/ will not wait for success/ fail to complete.
3.        Executes the current pending request asynchronously on the server.

This virtual method is asynchronous, which means that the code will continue to be executed without waiting for the server to respond.

Difference between $ Document .Ready Function (), Window. Onload ()?
$(document).ready ()
1. The document ready event it doesn't wait till all DOM content available e.g. images
2.  executes already when the HTML-Document is loaded and the DOM is ready, 
Window. Onload()
The window load event executes a bit later when the complete page is fully loaded, including all frames, objects and images.
1.     Therefore functions which concern images or other page contents should be placed in the load event for the window or the content tag itself.

How to delete 1000 items in list by JSOM?
camlQuery.set_viewXml(‘<View><RowLimit>1000</RowLimit></View>’);
 or
For loop method
var itemCount = collListItem.get_count();

How to get another site collection items by JSOM?
 Ans: To access information in the host web using the JavaScript Object Model you need to use a SP.AppContextSite object in conjunction with your SP.ClientContext.
var appweburl: string,
    hostweburl: string,
    context: SP.ClientContext,
    appContextSite:  SP.AppContextSite;

JSRequest.EnsureSetup(); // this is an easy method to retrieve URL parameters...
appweburl = decodeURIComponent(JSRequest.QueryString["SPAppWebUrl"]);
hostweburl = decodeURIComponent(JSRequest.QueryString["SPHostUrl"]);
// the context needs to be for the app web, so we can use get_current
context = SP.ClientContext.get_current();
// the appContextSite is for the hostweb,
// so we provide the hostweburl as the second parameter
appContextSite = new SP.AppContextSite(context, hostweburl);
 How to change asynchronous data to synchronous in JSOM?
The deferred/ Promise object is very simple syntax and powerful method for sequentially updating in the list/ list items. Initially, we need to declare the deferred object, as shown below.
var deferred = $.Deferred(); 
At the end of the function, we have to return Promise object.
return deferred.promise();
SP.ClientContext.prototype.executeQuery = function() {
   var deferred = $.Deferred();
   this.executeQueryAsync(
       function(){ deferred.resolve(arguments); },
       function(){ deferred.reject(arguments); }
);
return deferred.promise()

How to get people picker value by JSOM code?

Object is  SPClientPeoplePicker

How to get current login user name in JSOM?
this.currentUser = website.get_currentUser();


What are users Policies in SharePoint 2013, Office 365?
By default, a web application has these four permission policy levels predefined:
·      Full Control
·      Full Read
·      Deny Write
·      Deny All
Find  link
Master pages
v4.master This Is 2010 Master Page,Used for content and administration pages. Provides the interface and layout. this Team Site home page, list and library pages, and site settings page.
**Minimal master page(minimal.master)**Contains minimal SharePoint content, used for full-screen functionality or embedded applications.The home and search results pages on a Search Center, pages that host Word or Excel web applications.
SharePoint creates both a .master file and an associated HTML file with the same name in the Master Page Gallery.
Seattle is designed for intranet team collaboration with more features such as social, content\site navigation and management shortcuts.
oslo master page is designed for published site which focus on page layout and content rendering.

Client Object Model vs Server Object Model in SharePoint?
Using Client Object Model we can access the data from the system where SharePoint server is not installed on the machine via Web Services, API(application programming interface) , JavaScript etc.

Whereas In Server Object Model is like a Production Server Environment to access the data where share point server installed on the machine
Managed Object Model
Microsoft.SharePoint .Client.dll
Microsoft.SharePoint .ClientRuntime.dll
ISAPI folder
Silverlight client object model
Microsoft.SharePoint .Client.Silverlight.dll
Microsoft.SharePoint .Client.Silverlight.Runtime.dll
LAYOUTS\ClientBin folder
JavaScript client object model
SP.js
LAYOUTS folder
Different types of Objects:
Server object model
Managed Model
Silverlight Model
Javascript Model
SPContext
ClientContext
ClientContext
ClientContext
SPSite
Site
Site
Site
SPWeb
Web
Web
Web
SPList
List
List
List
SPListItem
ListItem
ListItem
ListItem
SPField
Field
Field
Field

What is the Visual web part properties?
We can easily Set properties and Get the properties from your application
public static string SampleText; 
public static int SampleNumber;
·         Category – This will group your property according to category. If not declared, “Miscellaneous” will be used as the default.
·         Personalizable – How the WebPart is configured, which can be per-user (PersonalizationScope.User), or for everyone (PersonalizationScope.Shared). For this example, we have chosen all users.
·         WebBrowsable – This will hide or show the property on the tool pane.
·         WebDisplayName – Label for the property.

·         WebDescription – Description for the property.
Rest Api
********
1.jQuery($.ajax) will be used to access all endpoints.
2._spPageContextInfo.webAbsoluteUrl may be new to you. Actually, it returns the current site url.
3.using the $.ajax calls and forming url endpoints and giving appropriate type like http methods next we should attempt headers.
4.$select specifies which fields to return in JSON results.
5.$expand helps to retrieve information from Lookup columns.
6.$top is used to apply paging in items.
         var urlForPaging = "/_api/Web/Lists/GetByTitle('SpTutorial')/Items?$top=2";

function getItems(url) {
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + url,
        type: "GET",
        headers: {
            "accept": "application/json;odata=verbose",
        },
        success: function (data) {
            console.log(data.d.results);
        },
        error: function (error) {
            alert(JSON.stringify(error));
        }
    });

}

Office 365 SharePoint Online interview questions and answers:
1- What is SharePoint Online? How it is related to Microsoft Cloud Service Office 365?
Ans: Office 365 is the cloud service provided from Microsoft which has lots of features. These features can be used as subscription based. Few services are like Mail, Calendar, People. Yammer, OneDrive, Planner, Task, Delve, Word, Excel, PowerPoint, OneNote, Sway, PowerApps etc. Apart from all these services, Microsoft also provides SharePoint as a part of the services. This is known as SharePoint online. It has all the features of SharePoint like on premise version. But Microsoft does not allow server side code in Office 365 SharePoint online. If you want to know features of Office 365, you can sign up for a trial version.
What is App Catalog in SharePoint 2013, SharePoint Online?
App Catalog site is a special site collection on a web application. Because each web application can have an App Catalog site, a farm can have more than one App Catalog site.
When you create an App Catalog site, you get two libraries for apps:
1. Apps for SharePoint
2. Apps for Office
You create the App Catalog site collection from SharePoint Central Administration
17- How can we retrieve SharePoint host web data in app web in SharePoint Add-ins?
Answer: Yes you can retrieve host web data from add-in web inside SharePoint hosted add-in. Read: How to retrieve host web site title in add-in web in SharePoint hosted add-in in SharePoint Online Office 365 Site?
var hostWebURL = decodeURIComponent(getQueryStringParameter("SPHostUrl"));Note the following about this code:
The getQueryStringParameter is a utility function that you create in the next step.
The decodeUriComponent is a standard JavaScript function that reverses the URI-encoding that SharePoint does on the query parameters; for example, an encoded forward slash, "%2F", is changed back to a "/".
Add the following code to the bottom of the file. This function can be used to read the query parameters.
// Utility functions
function getQueryStringParameter(paramToRetrieve) {
     var params = document.URL.split("?")[1].split("&amp;");
     var strParams = "";
     for (var i = 0; i < params.length; i = i + 1) {
         var singleParam = params[i].split("=");
         if (singleParam[0] == paramToRetrieve) {
             return singleParam[1];
        }
     }
}
function sharePointReady() {
var hostUrl = decodeURIComponent(getQueryStringParameter("SPHostUrl"));
hostcontext = new SP.ClientContext(hostUrl);
web = hostcontext.get_web();
hostcontext.load(web, "Title");
hostcontext.executeQueryAsync(onGetWebSuccess, onGetWebFail);
What are difference between SharePoint Online and SharePoint On-Premise?
Answer: There are lots of difference between SharePoint online and SharePoint on premise version. In SharePoint on premise, the server will be maintained by your organization, but in case of SharePoint online, everything will be maintained by Microsoft, you just need to use. Similarly patches and updates will be taken care by Microsoft, but in on premise environment, everything will be taken care by your IT team of the organization.In SharePoint online, Microsoft does not allows you to deploy any server side code but we can develop and deploy solutions using server object model in on premise environment. Alternatively Microsoft has improved client side object model and we can develop and deploy SharePoint Add-ins using client object model. Check out a very good article on: Difference between SharePoint online and SharePoint on premise.
 What are SharePoint Add-ins? Is it same as SharePoint Apps?
Answer: According to MSDN definition, 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. We can develop pages, lists, workflows, custom content types, list templates, Web Parts etc in SharePoint Add-in.
These are nothing but the Apps which has been introduced in SharePoint online and SharePoint 2013 versions. Microsoft later renamed Apps to Add-in. 
4- What are different types of SharePoint Add-ins?
Answer: There are two kinds of SharePont Add-ins.
1- SharePoint Hosted Add-in:
There are no server side code in case of 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.Custom pages in a SharePoint-hosted add-in are generally ASP.NET pages (ASPX) and they can declaratively reference ASP.NET and in-the-box SharePoint controls, but there can be no code behind. However, you can customize the SharePoint controls using a client-side rendering option and custom JavaScript.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.
SharePoint-hosted add-ins consist almost entirely of SharePoint components in an add-in web. A user can run a SharePoint-hosted add-in from a tile on the Site Contents page of the SharePoint website to which it's installed.
2- 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. The external components can be hosted on any web hosting stack, including the Linux, Apache, MySQL, PHP (LAMP) stack. When the remote components are implemented with .NET, the managed code SharePoint Client-Side Object Model (CSOM) library is available.
For remote components that are not based on .NET, there is a set of REST/OData APIs that can be used to access SharePoint data. These can also be used from a .NET client if you prefer working with an OData interface.
How we can deploy a SharePoint Add-in to SharePoint online?
Answer: We can deploy the SharePoint Add-ins to following two places.
- SharePoint Add-in Catalog: We can upload the SharePoint Add-in to organization's add-in catalog site. An Add-catalog, is nothing but a special collection in SharePoint online which contains a special type of document library that is used to upload and store app package files. Once you add the add-in to add-in catalog, the ad-in will be available to all SharePoint site collections. You can check a SharePoint video tutorial on: Video Tutorial Create and Deploy SharePoint Hosted Add-in using Visual Studio 2015
- To the Office Store: We can also deploy SharePoint Add-ins to Office store. Microsoft has a Seller Dashboard to help you sell add-ins through the Office Store.
After you deploy the add-in in either way, it's available for installation on the add an add-in page of SharePoint websites. 
 Can we use server side object model in SharePoint add-in?
Answer: No, we can not use any server side code in SharePoint Add-in. We can use only client side code like JavaScript Object Model (jsom) code (SharePoint hosted add-in) or Client side object model (csom, .Net managed object mode code) in Provider hosted add-in.
What object model we can use in provider hosted add-in in SharePoint online?
Answer: In provider hosted add-in we can use .Net managed object model code (csom). Here we can write code using below two dlls:   - Microsoft.SharePoint.Client.dll
          - Microsoft.SharePoint.Client.Runtime.dll
 Can we create web applications in SharePoint online?
Answer: We can not create web application in SharePoint online. We can create site collections from SharePoint Admin center.
Can we add custom domain in Office 365 SharePoint online?
Answer: Yes we can add custom domain in office 365 SharePoint online. You can go to Office 365 Admin Center and click on +Add a domain in the Domains section. 
Can we use site collection storage quota in SharePoint online?
Answer: Yes we can increase site collection storage quote in SharePoint site. We can do it from SharePoint Admin center. Read a SharePoint Online tutorial on: SharePoint online Office 365 how to increase SharePoint site storage quota.
We have a small organization, which Office 365 plan should I take?
Answer: There are lots of plans are available for your business needs. You can check out in Office 365 official site and you can compare and choose. 
Can we connect to SharePoint Online sites using PowerShell?
Answer: Yes, As a developer we can connect to SharePoint online site collections from PowerShell. We can do lots of operations using PowerShell in SharePoint online. For this we need to install "SharePoint online management shell". You check out a details SharePoint blog on How to connect to SharePoint online site using SharePoint Online Management Shell?
 How can we work with JavaScript object model in SharePoint online?
Answer: We can do lots of site collection level, list level or item level etc opeations using javascript object model in SharePoint online. SharePoint provides a script editor editor web part where we can write the JavaScript object model code. Or we can also develop SharePoint Add-ins and where we can write JavaScript object model code. You can read some JavaScript Object model (jsom) SharePoint online tutorials.
 How can we work with Rest API in SharePoint online?
Answer: Like Jsom, we can use Rest API inside a script editor web part or inside SharePoint Add-ins in SharePoint online. You can check out some SharePoint online rest api tutorials.
Can we use event receiver in SharePoint online?
Answer: We can not use event receivers in SharePoint online, instead we can use remote event receivers. Remote event receivers can be developed as a provider hosted add-in and can be deployed to Microsoft Azure. You can read SharePoint remote event receiver tutorial on: Steps to create a Remote event receiver for SharePoint Online and deploy into Microsoft Azure.
Can we develop visual web part for SharePoint online site?
Answer: We can develop visual web part as a sandboxed solution for SharePoint online sites. Sandboxed solutions are deprecated now a days, so better you should develop as a SharePoint Add-in.
What type of declarative components can you deploy for SharePoint Online?
Answer: Pages, lists, workflows, custom content types, list templates, Web Parts, Content Type, Site column etc.
Which features differentiate a SharePoint Library from a SharePoint List?
Answer: checkin\check out,Major,Minor version,Document mandatory
In SharePoint Libraries, permissions can be granted on which of the following?
Answer: folder,document set ,documents
In order for Sally to access sites hosted in SharePoint Online, which two tasks must be performed after her identity is added to Office 365 using directory synchronization? 
Answer: 1.An administrator must assign a SharePoint license to Sally
              2.Sally must be assigned permissions for the site collection on Office 365.
When saving the security certificate used for communications between SharePoint Server on-premises and SharePoint Online, the security certificate must be in which format?
Answer: Base-64 encoded X.509 (.CER)Base-64 encoded X.509 (.CER)
 A reverse proxy server is required for?
Answer: Outbound search.
The protocol for the Result Source used for Outbound search in SharePoint online is?
Answer: Remote SharePoint.
What is difference between host web and app web in SharePoint Online?
Answer: Before starting development in SharePoint Add-in, it is really important to understand what is host web and what is add-in web.
Host Web:
When an add-in that includes SharePoint components is installed on a website, it is listed on the Site Contents page from which it can be launched. That listing, which is the launch point of the add-in, is the only required addition to the website, although certain other things can optionally be added, such as a custom action or an add-in part. The website to which the add-in is installed is called the host web.
Add-in Web: Other than these UI elements, the SharePoint Add-in components and content, such as lists, content types, workflows, and pages, are deployed to a different website in a special isolated domain. This fact is largely hidden from the user. The special website to which the add-in is deployed is called an add-in web. 
App Web - Site on which the App is deployed
Host Web - Site on which the App is installed
App web URL - http://app-bdf2016ea7dacb.fabrikamapps.com/sites/Marketing/Scheduler
What is taxonomy and proxy.
 A taxonomy is a formal classification system. A taxonomy groups the words, labels, and terms that describe something, and then arranges the groups into a hierarchy

You can apply control globally across sites, or make local to specific sites.You can configure term sets to be closed or open to user contributions. You can choose to use enterprise keywords and social tagging with managed terms, or not.
Proxy:
When you use the web proxy, the webpages in your add-in can access data in your remote domain and the SharePoint domain.
jv