Sunday, 7 February 2016

75 SharePoint 2013 Interview Questions – Developer

Yesterday I shared some SharePoint 2013 IT Pro interview questions I had to use for a contract position I was filling, they are located here. In this post, I will share the correlating list of 75 developer questions I was using. In interviews, I rarely ask people to write code, so most of these are concept development questions. Things like how one used an object and basic C# constructs are left out, since there are numerous sources for that already available. These questions are specific to SharePoint 2013.
1) Describe the Cloud App Model.
The Cloud App Model that enables you to create apps. Apps for SharePoint are self-contained pieces of functionality that extend the capabilities of a SharePoint website.
2) Why build Apps?
Enables you to build apps for SharePoint by using familiar tools and a rich set of features. Familiar programming model and access to SharePoint data and services, Multiple options for hosting, Familiar user experience for end users, Integration with apps for Office, and SharePoint Store and App Catalog.
3) What as an App in its most basic form?
A web application that is registered with SharePoint using an app manifest
4) What is an app manifest?
An app manifest is an XML file that declares the basic properties of the app along with where the app will run and what to do when the app is started.
5) Where can the code for an app run?
SharePoint-hosted apps, Provider-hosted and auto hosted apps, Apps that have a mix of components in SharePoint and in the cloud
6) How does an app communicate with SharePoint?
  1. REST and JavaScript APIs
  2. Managed APIs (.NET)
7) How can the app authenticate to SharePoint?
  1. Inside SharePoint
  2. In the cloud
8) How are apps distributed?
Apps for SharePoint are distributed as an app package.
9) What are some options for app publishing?
  1. Public SharePoint app store
  2. Organization’s app catalog
10) What is OData?
 The Open Data protocol (OData) lets you access a data source, such as a database, by browsing to a specially constructed URL.
11) What is the primary benefit of OData?
Simplified approach for connecting to and working with data sources that are hosted within an organization.
12) What technologies does OData use?
  1. HTTP
  2. Atom
  3. JavaScript Object Notation (JSON)
13) How can you avoid direct code against the OData source?
Business Connectivity Services (BCS) can communicate with OData sources, or producers, without having to code directly to the OData source.
14) What is an OData producer, and some examples?
Producers expose their data in a structured way via a web service. Examples include SharePoint Foundation 2010, SharePoint Server 2010, SQL Azure, Windows Azure Table Storage, Windows Azure Marketplace, SQL Server Reporting Services, Microsoft Dynamics CRM 2011, Windows Live.
15) What is OAuth?
An open protocol for authorization.
16) What does OAuth enable?
Secure authorization from desktop and web applications in a simple and standard way.
17) What is OAuth used?
To authorize requests by an app for SharePoint to access SharePoint resources on behalf of a user and to authenticate apps in the Office Store, an app catalog, or a developer tenant.
18) What is an Access token?
Access tokens are issued by the OAuth security token service (STS) to request app permissions.
19) What are the three types of authorization policies?
user-only policy, user + app policy, or app-only policy
20) How does an app for SharePoint requests permissions to access SharePoint resources?
An app for SharePoint requests the permissions that it needs during installation from the user who is installing it and then the developer of an app must request, through the app manifest file, the permissions an app needs.
 21) How is an app granted the permissions requested?
An app must be granted permissions by the user who is installing it and users can grant only the permissions that they have; the user installing the app must be able to grant all permissions required by the app, or app installation fails.
 22) When is an app granted the permissions it asked for?
An app is installed by a website administrator, a app is explicitly granted permission by a tenant administrator or website administrator or an end user gives consent.
23) What are scopes in terms of SharePoint permissions?
Scopes indicate where in the SharePoint hierarchy a permission request applies.
24) What are some of the features of Office 365 Development Tools?
Create and manage projects, develop apps, share and publish apps.
25) What office technology can be used to build SharePoint 2013 workflows?
Visio 2013 includes a SharePoint 2013 Workflow template that can be used.
26) What is a workflow stage shape in SharePoint Designer 2013?
A stage can contain any number of shapes and may include branching. The stage or step itself might be one node of a longer workflow.
27) What is a workflow loop shape in SharePoint Designer 2013?
Loops are a series of connected shapes that will execute as a loop, returning from the last shape in the series to the first, until a condition is satisfied.
28) What is a step shape in SharePoint Designer 2013?
Steps represent a grouped series of sequential actions.
29) What is an example approach to navigate SharePoint data structure in SharePoint 2013?
Managed code or the SharePoint REST service.
30) What is the SPContextWebInformation structure?
Contains the initialization properties that can be used in subsequent REST requests.
31) What is a WebInfo object?
From REST resources it is an object that contains the scalar properties of the site, but that does not include any associated entity sets such as list collections or field collections.
32) What request type from a REST resource allows one to create a SharePoint object?
POST request.
33) What request type from a REST resource allows one to access the contents of a file ?
GET request.
34) What request type from a REST resource allows one update the contents of a file?
 PUT request.
35) What request type from a REST resource allows one to delete a SharePoint object?
POST to that resource including an X-Http-Method header of DELETE.
36) What are HTML ETags?
The SharePoint REST service uses HTML ETags for concurrency control.
37) What are ETags useful for?
When you perform a PUT, PATCH, MERGE, or DELETE request, you can specify an ETag in the If-Match HTTP request header.
38) What are the factors to consider when choosing a SharePoint API?
The type of application, existing skills, and the device on which the code runs.
39) What is Client-side rendering?
Client-side rendering provides a mechanism that you can use to produce your own output for a set of controls that are hosted in a SharePoint page.
40) What are remote event receivers?
Remote event receivers handle events that occur to an item in the app, such as a list, a list item, or a web.
41) What is Microsoft Push Notification Service?
Using the Microsoft Push Notification Service (MPNS), Windows Phone apps can receive notifications through the Internet of events triggered on Microsoft SharePoint Server.
42) What is the benefit os MPNS?
 The app can be registered to receive notifications from the server, and an event receiver can initiate a notification and send it to the receiving app for handling.
43) What are some benefits of the new Geolocation field type?
Allows incorporation of location, maps, and proximity search features into their web and mobile apps and solutions.
44) What are interactive social feeds?
Interactive social feeds are designed to encourage people to share information and to stay connected with people and content.
45) What are some common programming tasks when working with social feeds?
Get the user for the current context, get the feed for the current user, get the personal feed for a particular user.
46) What are feed types?
Feed types represent slices of feed data.
47) What are some examples of feed types?
Personal, News, Timeline, Likes, and Everyone.
48) What method do the server, client, and JavaScript object models use to retrieve feed types?
The GetFeed method.
49) What API’s can be used to programmatically follow people?
Client object models, mobile client object model, JavaScript object model, representational State Transfer (REST) service, and server object model.
50) What is the SocialFollowingManager object?
Consolidates the core Following People and Following Content functionality for the current user.
51) What is the PeopleManager object?
Provides some functionality that SocialFollowingManager does not provide, not really worth grilling about.
52) What is an external content enrichment web service?
Enables users to modify the managed properties of crawled items before they are indexed.
53) At a high level, how does the web service client work?
The web service client works with managed properties that you can configure as input properties or as output properties.
54) What is a trigger condition in terms of a web service callout?
A trigger condition is an expression that is used to configure the web service callout.
55) How does one use the Search .NET Framework managed CSOM?
Get a ClientContext instance then use the Microsoft.SharePoint.Client.Search.Query namespace
56) Do custom search solutions support SQL syntax?
No.
57) What are Query properties?
Provide information about a search query.
58) What is the the ONEAR operator?
Provides ordered near functionality.
59) What is a display template in terms of SharePoint search?
Display templates define the visual layout and behavior of a result type by using HTML, CSS, and JavaScript.
60) What are result types in terms of SharePoint search?
Result types define how to display a set of search results.
61) How does one use the connector framework in terms of SharePoint search?
Enables you to retrieve claims information for content stored in custom external data sources that are crawled.
62) What is Keyword Query Language (KQL)?
Allows you to you specify the search terms or property restrictions that are passed directly to the search service.
63) What is FAST Query Language (FQL)?
FQL is a structured query language that supports advanced query operators.
64) What is the workflow execution host in the new workflow infrastructure in SharePoint 2013?
 Windows Azure.
65) Are workflows are no longer compiled into managed assemblies?
No they are fully declarative.
66) What is meant by a fully declarative workflow?
 The workflow is described (literally) in XAML and then executed interpretively at run time.
67) What is the Design Manager?
The Design Manager enables a step-by-step approach for creating design assets that you can use to brand sites.
68) What is the Snippet Gallery?
Allows a user to select a component, configure its properties and update the snippet, copy the HTML snippet that’s generated, and paste that HTML snippet into your HTML file.
69) What are Device channels?
Device channels define channels for one or more devices allowing finely-tuned control over how mobile users experience your site.
70) What is managed navigation?
 Managed navigation is the taxonomy-based alternative to the traditional SharePoint navigation feature.
71) What are Catalogs?
Allow you to incorporate lists into your publishing sites.
72) At a high level, what is cross-site publishing?
Enables you to reuse content across multiple site collections.
73) What is the Machine Translation Service?
The Machine Translation Service is a new service application in SharePoint 2013 that provides automatic machine translation of files and sites.
74) What is PowerPoint Automation Services?
Allows conversion from the PowerPoint binary file format (.ppt) and the PowerPoint Open XML file format (.pptx) to other formats.
75) What are the supported source presentation formats?
Open XML File Format presentation format (.pptx) and PowerPoint 97–2003 presentation (.ppt).

Wednesday, 27 January 2016

Getting started with Office 365 development – Part 2 – Communicate with the Exchange REST API

This article is part of a series about “Getting started with Office 365 development”.
In this article we will take a quick look at how you can get started with constructing your own queries to fetch information from Exchange Online hosted in your Office 365 subscription. We will take a look at how you can dig into the REST API’s and how we can fetch the information we require quickly and easily from Exchange Online in Office 365 using a simple ASP.NET MVC web application.
In my previous post I talked about how to setup your environment, and I created a project calledZimmergren.O365.MyContent there, which is a sample application that I will use throughout this article series – check out that post if you need more information on the project type etc.

Investigating the sample code

Before we dig into the Office 365 Exchange REST API’s and create our own application to retrieve information from your inbox, we’ll dig into the existing samples that come with the MVC project using the Office 365 tools (see previous post) and we’ll take a look at what we need to modify in order to fetch the proper information from the service.
In our freshly created sample project, we’ve got the following setup:

View: Mail.cshtml

@model IEnumerable<Zimmergren.O365.MyContent.Controllers.SampleModel.Exchange.Message>
@{
ViewBag.Title = "Exchange Sample";
}
<h2>@ViewBag.Title.</h2>
<h3>Recent emails</h3>
<table class="table table-bordered table-striped">
<tr>
<th>
Subject
</th>
<th>
From
</th>
<th>
Received
</th>
</tr>
@{
//To display dates and times using the user's local timezone:
// * On the server-side, calculate the number of milliseconds elapsed since the Date epoch
// used by JavaScript.
// * In JavaScript, convert the milliseconds to a timezone-aware string.
DateTime JavaScriptDateEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
}
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Subject)
</td>
<td>
@Html.DisplayFor(modelItem => item.From.Name)
</td>
<td>
@* Create an empty span, tagged with a "data-datetime" attribute representing the
milliseconds since JavaScripts epoch time.
A JavaScript function (below) will then convert the attribute into a timezone-aware string. *@
<span data-datetime="@item.DateTimeReceived.Subtract(JavaScriptDateEpoch).TotalMilliseconds"></span>
</td>
</tr>
}
</table>
<script type="text/javascript">
// Finds all spans tagged with a "data-datetime" attribute, and sets their texts
// based on the user's local timezone and locale.
var allSpans = document.getElementsByTagName("span");
for (var i = 0; i < allSpans.length ; i++) {
var span = allSpans[i];
if (span.attributes["data-datetime"]) {
var date = new Date(0); // Initialize the Date object to the epoch.
date.setUTCMilliseconds(span.attributes["data-datetime"].value);
span.textContent = date.toLocaleString();
}
}
</script>
view rawMail.cshtml hosted with ❤ by GitHub

Controller: ExchangeSampleController.cs

The controller contains a method called “Mail”, which looks like this:
/// <summary>
/// Displays recent messages in the user's inbox.
/// Minimal permission required: permission to read users' mail.
/// </summary>
public async Task<ActionResult> Mail()
{
// Obtain information for communicating with the service:
Office365ServiceInfo serviceInfo = Office365ServiceInfo.GetExchangeServiceInfo();
if (!serviceInfo.HasValidAccessToken)
{
return Redirect(serviceInfo.GetAuthorizationUrl(Request.Url));
}
// Create a URL for retrieving the data:
string[] queryParameters =
{
"$orderby=DateTimeSent desc",
"$top=20",
"$select=Subject,DateTimeReceived,From"
};
string requestUrl = String.Format(CultureInfo.InvariantCulture,
"{0}/Me/Inbox/Messages?{1}",
serviceInfo.ApiEndpoint,
String.Join("&", queryParameters));
// Prepare the HTTP request:
using (HttpClient client = new HttpClient())
{
Func<HttpRequestMessage> requestCreator = () =>
{
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, requestUrl);
request.Headers.Add("Accept", "application/json;odata=minimalmetadata");
return request;
};
// Send the request using a helper method, which will add an authorization header to the request,
// and automatically retry with a new token if the existing one has expired.
using (HttpResponseMessage response = await Office365CommonController.SendRequestAsync(
serviceInfo, client, requestCreator))
{
// Read the response and deserialize the data:
string responseString = await response.Content.ReadAsStringAsync();
if (!response.IsSuccessStatusCode)
{
return Office365CommonController.ShowErrorMessage(serviceInfo, responseString);
}
var messages = JObject.Parse(responseString)["value"].ToObject<SampleModel.Exchange.Message[]>();
return View(messages);
}
}
}

Default sample results

If we just run the sample code without modifying it, and visit the /ExchangeSamples/Mail url in our application, this will be the result:
image
This is a great sample of how the code can be constructed in order to retrieve this results. However, if we want to modify the above result by for example adding a few properties like “Read/Unread” and “Priority” to the query in order to see how we can fetch more information from the API’s.

Final results when we are done

This is what the final results of our walkthrough will look like:
image

We simply want to add more fields to our query in this sample to investigate how we can find and fetch information from the Office 365 API’s.
So keep the final result above in mind, even if it’s a simple one, because the next few sections will explain exactly how you achieve this result.
The next section will discuss how we can explore the Exchange REST API. Keep reading!

Investigating the Exchange REST API references

In order to understand how to add the information we want (Importance, Read/Unread flags like in my picture above), we need to understand how the information is provided and structured. The easiest way to do this is to explore the REST API endpoints directly using a REST tool of choice. My favorite tool is the Chrome-plugin called “Advanced Rest Client”. Read more about this and many other tools in a previous post here.

Finding the REST endpoint that we want

There’s a few ways to find the correct REST endpoint. One is to visit MSDN and read their articles on the REST API (recommended), and the other is to investigate where our code is executing the request and copy it from there.
If we dig into the “How to: Work with email by using the Mail REST API” on MSDN, we can see that the API is pretty nice and covers a lot of ground already.
In our sample code provided by the Office 365 extension tools, we see that the request is made through the following call:
https://outlook.office365.com/ews/odata/Me/Inbox/Messages
view rawgistfile1.txt hosted with ❤ by GitHub
Now, if we’re interested in learning more about what comes out of that
REST endpoint we can use the tool of your choice (Advanced Rest Client in Chrome for me..) and just type in that Url like so:
image
This will yield a result in JSON similar to this, including the highlighted data which is the most interesting to us for now:
image
If we take a look at the highlighted properties, we can see that they contain the data we are interested in – and so we have secured what properties/data we need to fetch from our code.
The next step will be to modify the sample code to include the two additional things we want: “Importance” and “IsRead“.

Modify the query, view and controller to include the Importance and IsRead data

We’re almost done. The last thing we need to do is to modify the existing code samples by extending them with the two new fields we want from the REST endpoint.
First we modify the controller, then the view and then we smile and enjoy the result. Happy times!

Modify ExchangeSampleController.cs

In order to include our two new requirements, we should modify the query parameters for our existing query. This is done very easily but just adding “,Importance,IsRead” to the existing $select statement like this:
// Create a URL for retrieving the data:
string[] queryParameters =
{
"$orderby=DateTimeSent desc",
"$top=20",
"$select=Subject,DateTimeReceived,From,Importance,IsRead"
};
Great, so the actual Mail task in the Controller has been modified to fit our requirements. Nothing special happening here.
The second things we need to modify the the placeholder class for our Message-data so it will include thw two new fields:
public class Message
{
public DateTime DateTimeReceived { get; set; }
public Recipient From { get; set; }
public string Subject { get; set; }
// Zimmergren: Added the Importance-field to the samples
public string Importance { get; set; }
// Zimmergren: Added the IsRead-field to the samples
public string IsRead { get; set; }
}
view rawMessage.cs hosted with ❤ by GitHub

Modify Mail.cshtml

First we modify the HTML table to include two new table headers called “Importance” and “Read?”:
@*zimmergren: Added to the sample*@
<th>Importance</th>
@*zimmergren: Added to the sample*@
<th>Read?</th>
view rawPartial_Mail.cshtml hosted with ❤ by GitHub

Next we modify the actual foreach-loop in the view to include the same fields:

@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Subject)
</td>
<td>
@Html.DisplayFor(modelItem => item.From.Name)
</td>
<td>
@* Create an empty span, tagged with a "data-datetime" attribute representing the
milliseconds since JavaScript's epoch time.
A JavaScript function (below) will then convert the attribute into a timezone-aware string. *@
<span data-datetime="@item.DateTimeReceived.Subtract(JavaScriptDateEpoch).TotalMilliseconds"></span>
</td>
<strong>@*zimmergren: Added to the sample*@
<td>@Html.DisplayFor(modelItem => item.Importance)</td>
@*zimmergren: Added to the sample*@
<td>@Html.DisplayFor(modelItem => item.IsRead)</td></strong>
</tr>
}
view rawgistfile1.txt hosted with ❤ by GitHub
Okay, so we’ve added the last few lines there with the two new properties to match the updated model we’re using. This should be enough to fetch the e-mails and include the two new fields.
After dropping myself a few new sample-emails we can see that the application works and it’s reflecting the changes as expected, including the importance/read flags:
image
Pow!

Summary

This post should give you enough information to get started with the new Office 365 API’s for Exchange including ways to explore the REST API and modify the code to reflect our changes. We haven’t done anything fancy yet, but this should serve as a plate for future modifications – now we know how it works.
This concludes part 2 in this article series, keep an eye out for the next few articles in the series.
Enjoy!