Wednesday, December 23, 2015

Using SPWeb.EnsureUser in SharePoint

I faced this scenario many times and when I Googled, there are many who have faced the same. I had added an Active Directory group to the site members group. Then I asked them to log in and make requests for a particular business scenario that triggered workflows. I had a scenario that another user could make a request on behalf of another. Simply someone is asking to reset an AD account of a person who lost his password. Given that there is a need to add a new list column called 'On Behalf Of' which is a person or group column, I simply used code to create an SPUser object through C# code using the people picker value where people picker was available in the request form to select the on behalf of user. 

I got the username from the people picker comma separated values and used the following code to get the user.

SPUser onBehalfOfUser = web.AllUsers[onBehalfOfuserLoginName];

Monday, December 21, 2015

Sideloading SharePoint Add-Ins

If you are a SharePoint Add-in or App developer, you could have probably come through this issue atleast once. 

"Sideloading of apps is not enabled on this site."

Sideloading is a technique that most of the app vendors allow in order to test or debug the apps. In other words, it means deploying an app with a development tool rather than going through the correct secure procedure. Sideloading is available with all the smartphone platforms including Android. 

When you are developing a SharePoint Add-in, you need to test the Add-in prior to do a proper release. There is a default site collection template that is known as "Developer Site" which allows you to sideload add-ins from Visual Studio rather than putting it to an app catalog or online store. 

But if you attempt to deploy an add-in to another site with a different template, then you may encounter the issue which is highlighted above. Now we have two options. The preferred option is to change the deployment target to a developer site. 

Thursday, December 17, 2015

Automatic Index Management in SharePoint 2016

5,000 is a familiar number for anyone who had more than 5,000 records in a SharePoint list. List View threshold is something that many of us have faced and wanted to get rid of it by expanding. But then again we think about the best practices and the good it does. So, we often end up not increasing it, but creating some indexes on the columns. The problem is many of us did not know this can be done. Even I did not in the beginning. I am sure many of us still do not know. 

Microsoft has figured out there are many among us who do not do it and have introduced something that will make the job easy. The good thing is SharePoint can make note of every query we make and find the columns that need to be indexed.

This new feature is called Automatic Index Management. Here are some characteristics on it and how it functions.

What is Automatic Index Management?

It is a setting that is by default enabled for SharePoint lists from SharePoint 2016. It creates automatic indexes for the SharePoint lists by evaluating the queries and other concerns that matter most for improving the performances.

Tuesday, December 1, 2015

Using SPList.ItemCount vs SPList.Items.Count

Developers need to write code that doesn’t consume all the server resources, so they try to use the best API calls that require minimum resources. Many feel that when it comes to using SPList.ItemCount versus SPList.Items.Count, SPList.ItemCount is a better API call. But let’s examine this more carefully.

What are the Definitions?

The MSDN definitions for both scenarios are as follows:

SPList.ItemCount: The value of the ItemCount property includes folders within a document library, as well as files within subfolders. The value of the Count property of the SPListCollection class doesn’t include folders.

SPList.Items.Count: The Items property returns all the files in a document library, including files in subfolders, but not the folders themselves. In a document library, folders aren’t considered items.

Therefore we can conclude that SPList.Items.Count gets the number of list items in the collection, excluding folders.

Thursday, November 26, 2015

MinRole in SharePoint 2016

We all have to make some tough decisions when making larger SharePoint environments. One of the toughest is which SharePoint services shall be running on which server. We would like our servers to be busy at same levels, but it is difficult to find the correct formula most of the times. Microsoft has been running SharePoint on online servers for a few years so far and with currently over 20,000 databases over 19 databases across the world, its unlikely there is anyone better who knows which services work well together other than Microsoft.

MinRoles are predefined types of server roles that that will maximize the optimization of SharePoint workloads across the servers. The good thing about MinRoles is that you can select it at the point of installation and change at some scenarios even sometime after the provisioning. As it is the SharePoint Server 2016 Beta 2 which is the latest release available, there are six predefined MinRoles.

Wednesday, November 25, 2015

SharePoint Workflow HTTP Unauthorized to...

This is an issue being discussed all over the internet and many articles suggest the number 1 fix for this as checking the existence of the user profile service and the user profile synchronization service as started. Also that is the best place to start looking into. 

In our case it was different. This was working well a few days ago and suddenly goes off without any notice. Now this is strange. The situation can be briefly summed up as this. 

  • Our domain controller is located in a separate network which is connected to this environment through a VPN.
  • I try to start the workflow through a PowerShell code. (Run as Administrator and impersonate the workflow start process to another user with necessary permission)
  • Workflow starts and display the following message in the status. 

Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP Unauthorized to http://sitename/_vti_bin/client.svc/web/lists/getbyid(guid'guid') Correlation Id: id Instance Id: id

Saturday, November 21, 2015

Speaking at European SharePoint Conference

I am writing this about a week after the European SharePoint Conference 2015 while on the way back to Sri Lanka after a tour in Germany. 

It was a good opportunity to speak at the Europe's largest SharePoint Conference which was held at Stockholm, Sweden this year. I got to deliver the session T9, which was on Exploring the Potentials of Skype for Business. 

Its no doubt that Skype for Business has made a huge progress over the past few years as a Unified Communication Tool for enterprises. The numbers are ever growing and so does the features and the capabilities. I started with a little introduction to what are the cool features that were not much used or highlighted within the people though they can make your days productive. It included 2 demos including a basic introduction and then a deep dive in to meeting capabilities. 

Tuesday, November 3, 2015

SharePoint Speakings at Oslo

Excited to be speaking twice at Oslo this November on the eve of the European SharePoint Conference. I will be doing 2 sessions on "Success Story of SharePoint Development on Azure". This was initially spoken at the Business 365 Saturday Singapore and this time it will be 2 meetups at Oslo and it will be sponsored by Exilesoft.

1. 5th November 5pm at Norwegian SharePoint Community Meetup

Meetup page url here

2. 6th November 8.30am at Exilesoft AS, Oslo

Wednesday, October 28, 2015

Creating a SharePoint list and Adding List Items in SharePoint Apps

In my previous article I explained how to read from a SharePoint list available inside a SharePoint App site. In this article my focus would be on how to create a list inside the app and how to add list items to it. The same app I used in the previous example will be used here. Here is the code available in my Default.aspx file. It is simple just a textbox and a lable inside a HTM table and a div which includes an unordered list.

I will start having the same set of definitions in the top.

var context = SP.ClientContext.get_current();
var web = context.get_web();
var user = context.get_web().get_currentUser();
var lists = web.get_lists();

Wednesday, October 21, 2015

Business 365 Saturday Singapore

I will be speaking at the Business 365 Saturday Singapore on 24th October 2015 and already done with the slides and other preparations. If you are hanging around Singapore 24th Saturday, this is a must visit that you may not want to miss. 

Many good sessions arranged to 3 separate tracks make it a day for Business users, developers as well as IT administrators. All in all I am again glad to be a part of a good speaker line up.

If you aren't done registering for the event yet, Hurry up! only a few days left. Register here..  

Here are the two sessions I will be conducting along with a brief summary on each.

Thursday, October 15, 2015

SharePoint Dev on Azure at SharePoint Sri Lanka

I got the opportunity to speak on "Moving your SharePoint Development to Azure" at the SharePoint Sri Lanka October Monthly User Group meeting held at Microsoft Sri Lanka.

Wednesday, October 14, 2015

My Articles on Visual Studio Magazine

I though of pulling up some articles that are written by me on Visual Studio Magazine as I found them interesting and as a part of putting things into a single place.

Where JavaScript and SharePoint Apps Intersect

SharePoint is versatile, in that developers can interact with its data via other programming languages besides what's in Visual Studio. Here's how AngularJS fits into the development mix.

Wednesday, September 23, 2015

Mobile Device Management for Office 365 at Collab 365

Collab 365 is around the corner. About two weeks time left for October 7th and 8th with the time flying so fast. I will be doing a session on "Mobile Device Management for Office 365" this time. All the recordings are done and now need to do the final touches and submit the pre-recorded session.

In this session I speak about the advantages and features associated with Mobile Device Management. Also a few cool demos included in order to show how easy it is to activate Mobile Device Management for Office 365, how to setup the device policies and also how to add a Workplace account to Windows Phone and see the policies get set up. 

Tuesday, September 1, 2015

Response 429 for SharePoint REST API

Recently I got to work on an instance where it continuously made many REST API calls to SharePoint within a limited amount of time. It was a set of workflows where around 2000 workflows started at a limited amount of time. To make things worse, all these workflows were started from the same user. 

The response 429 is for Too Many Requests.

Tuesday, June 23, 2015

4 Great SharePoint 2013 Branding Features

Branding SharePoint sites was an easy task prior to SharePoint 2013. Many developers focused on supporting a few versions of Internet Explorer and asked users to use it for SharePoint-related activities.

Then Microsoft announced SharePoint 2013, which works well with an array of additional browsers and devices thanks to responsive design. With the need to make designs more responsive and facilitate multiple browsers, Microsoft has brought the design process to a new level with multiple components.

Before we look at four branding features in SharePoint 2013, it's important to mention the SharePoint 2013 Design Manager component, which better facilitates designing and branding capabilities. It takes care of overall design of a SharePoint site by providing some great customizable options. Design Manager is located at the "Look and Feel" section of the "Site Settings" page.

Saturday, June 20, 2015

2 Sessions at SPBiz Conference

I was chosen to deliver 2 sessions at the SPBiz Online Conference held on June 2015. It was great to line up with some great speakers around the world.

The two sessions conducted are as follows along with the slide decks.

Wednesday, June 3, 2015

Single Sign-On in SharePoint: Why I Like Secure Store Service

SharePoint isn't a product created to function alone. Many of its features allow data or the functionalities from external systems to be integrated with SharePoint. It has several APIs to integrate with web services and Business Connectivity Services to integrate data from other sources.

Most organizations have integrated SharePoint with Windows Authentication, so the user doesn’t have to even type credentials to log into SharePoint.

But how about allowing a SharePoint user to sign into another system for another functionality? Is there something like a single sign-on (SSO) that keeps the user from having to enter credentials to the same service again and again?

Monday, March 30, 2015

Speaking at SharePoint Saturday Cairo 2015

I got the opportunity to conduct an online session on "Branding and designing capabilities with the Design Manager" as invited by Mai Omar Desouki at the SharePoint Saturday Cairo 2015 which was held on 28th March 2015.

Friday, March 13, 2015

Branding and Design Capabilities at SharePoint Sri Lanka

Design Manager in SharePoint 2013 provides many capabilities for customizing the look and feel of your SharePoint sites and graphics included with in. I spoke about the Branding and Design capabilities along with some demonstrations on how to get things done very easily.

Thursday, February 5, 2015

SharePoint 2016 Development Predictions

Its few months before Microsoft officially make announcements on the SharePoint 2016 version which we can assume will happen at Ignite event to be held in Chicago. After going through several articles including the one at office blog, I thought of making some predictions on 2016 capabilities that will matter of the developers and designers.