My first year as a Microsoft MVP

On May 1, 2018, I got my first “Most Valuable Professional” award by Microsoft. I was so happy on that day when the email from Microsoft arrived confirming that I got MVP award in the “Office 365 Development” category:


A few days later, I received a package full of MVP goodies from the Microsoft Canada team:

20180509_085247_HDR - Copy

And again after a few more days, I received my MVP award kit:

20180510_145805_HDR - Copy


It has been 1 year since getting an MVP award, and I am still a Microsoft MVP. I will continue to remain Microsoft MVP till June 30, 2019. When Microsoft announces MVP renewals on July 1, 2019, I hope to be renewed as an MVP once again.

So who gets a Microsoft MVP award? What does it mean to a Microsoft MVP?

There are many misconceptions in the mind of people in general about being a Microsoft MVP. I tried to answer a few of those “myths” below:

MVP Myth#1 MVP is a Microsoft employee

That’s the most common misconception which I encountered in the last one year. Many people who came to attend meetups hosted by me, or I met at technical events had that misconception – “Oh, you work for Microsoft, right?”. No, a Microsoft MVP is not a Microsoft employee.

MVP Myth#2 MVPs are paid by Microsoft to promote its technologies

Microsoft does not pay us anything to promote its technologies. It’s true that being a Microsoft MVP, any new technologies/products rolled out by Microsoft will be highlighted by us first. But it is out of passion, and that’s what made us MVP in the first place. There isn’t any monetary benefit involved.

MVP Myth#3 MVPs are experts in all Microsoft technologies

The MVP award is awarded mostly in one of the many categories. e.g. I am MVP in “Office 365 Development” category. There may be MVPs who are awarded in more than one category. But these categories mean that we had valuable contributions in those areas. It has nothing to do with the expertise of the person being awarded. It can be possible that an MVP has expert knowledge in his/her award category, but may not be in all others.

MVP Myth#4 MVPs earn a lot of money for being an “MVP”

It’s true that being an MVP gets you recognition and it is definitely going to help you in getting business or finding a job. But only “being” an MVP does not automatically earn you any money. You have to continue doing your best in your professional life.


So again, what does it mean to be a Microsoft MVP?

Being a Microsoft MVP means one is constantly contributing for the betterment of the technical community around him/her. That contribution can be in the form of hosting meetups, speaking/organizing conferences, writing blogs, mentoring and many more other avenues. Being an MVP means that person has done significant contributions in the public domain in one of the areas of MVP categories.

Which benefits do I get for being a Microsoft MVP?

As mentioned above there is no monetary benifit involved. But there are many other benefits one gets from Microsoft and its partners. Most of those are in terms of subsciptions to various online services or licenses for softwares.

I got invited to represent Microsoft at various events happening in and around Toronto. I represented Microsoft at “Hack the North” and “Disrupt AI” hackathons as a mentor and judge. I presented a session on Excel programming at “Microsoft Ignite The Tour | Toronto” in January 2019.

We also get invited to a big event called “MVP Summit” once a year which takes place at Microsoft HQ in Readmond near Seattle, US. We meet MVPs from across the world, get a chance to meet Microsoft employees and other prominent Microsoft personalities who are attending the MVP Summit. This year the MVP Summit was held from March 17 to 22, 2019 and I had a blast:





What’s Next?

In the coming year, I plan to keep continuing serving the technical community in the Greater Toronto Area. I wish to be renewed as Microsoft MVP again. Eagerly waiting for July 1, 2019!

Here is to coming many more years as a Microsoft MVP !!!

Write your first program using Microsoft Graph SDK

Download source code associated with this article here- MSGraphSDKConsoleApp.


In this article, I will explain you how you can write your first program to interact with MS Graph API using MS Graph SDK in Visual Studio.

Microsoft Graph API is a powerful way to interact with Office 365 data. MS Graph API gives you a single REST API endpoint which you can call to interact with “almost anything” in Office 365.

Read my article here to know more about MS Graph API.

If you want to follow the steps mentioned here, then there are some prerequisites which you must have, otherwise you can continue reading.


  • Visual Studio 2017

Don’t have VS 2017? Download free “Visual Studio Community 2017” here.

Read my article how to install VS2017 here.

  • Office 365 subscription

Don’t have Office 365 subscription? Read my article here about how to get 1-year free Office 365 developer subscription.

Even if you have Office 365 account from your employer, I strongly suggest not to use it for development purpose.

  • Microsoft Graph SDK

MS Graph SDK is a class library with ready to use code for interacting with MS Graph API. It’s freely available as a NuGet package and can be easily added to your project from Visual Studio NuGet package manager.

Read more about MS Graph SDK in my article here.


Let’s get started.

Open Visual Studio. I am using VS 2017 community edition for this article:

1 VS 2017

Click on “Create new project” in start page:

2 Create project

Select “Console App”, give proper project name, click Ok to create a new project:

3 Console

Configure your Application

Once you have created a new project, you need to configure it so that authentication using Microsoft account (your Office 365 developer account) can be done in your application and you can receive a token required to access data using MS Graph API. For that you need to go to Microsoft App Registration Portal.

Please note these steps of registering your application are explained in detail in my articles here and here.

Open Microsoft App Registration Portal located at and login with your Office 365 developer account.

Click on “Add an app” button on top right:

4 add an app

Enter application name and click “Create”:

5 create app

Alternatively, you can also click on “Let us help you get started” checkbox and the wizard will guide you step by step.

A new application is created for you, please note it’s application id which we will need in next steps:

6 app id

Under the platforms, click “Add Platform” button:

7 platform

Select “Native Application”:

8 Native platform

Why we use “Native Application”?

Because we are writing code for a console application which is going to run on Windows OS. If it was a web application, then you would select “Web” and similarly “Web API” for an API.

You don’t need to make any more changes in MS App Registration Portal. Click on “Save” button at the bottom of the page.

Back to VS 2017 now. We need to configure our application with the application id we just created.

Open the App.config file. Add a new key “clientId” under appSettings, paste the application id from MS App Registration Portal in value section:

9 clientid

 Add MS Graph SDK to project

Simply search for “Microsoft Graph” in package manager and add “Microsoft.Graph” and “Microsoft.Graph.Core” packages.

Also add “Microsoft.Identity.Client” package as it’s required for authentication code.

Need more detailed steps? Read “Adding MS Graph SDK to your C# application” section of my article on MS Graph SDK here.


Write code

In the following section, I will explain you how to write simple code which calls MS Graph API to fetch logged in user’s details.

I will also explain code required to authenticate user using Microsoft account.

The first piece of code you need to write is to authenticate user and get access token:

static async Task<string> GetTokenAsync(PublicClientApplication clientApp)


//need to pass scope of activity to get token

string [] Scopes = {“User.Read"};

string token = null;

AuthenticationResult authResult = await clientApp.AcquireTokenAsync(Scopes);

token = authResult.AccessToken;           

return token;


Note here the most important code is clientApp.AcquireTokenAsync(Scopes) which will redirect user to Microsoft login page, show consent for permission(s) required by your application for given Scopes.

Then you need to write code to get MS Graph client to deal with MS Graph API:

PublicClientApplication clientApp = new PublicClientApplication(ConfigurationManager.AppSettings["clientId"].ToString());

GraphServiceClient graphClient = new GraphServiceClient(


new DelegateAuthenticationProvider(

async (requestMessage) =>


requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", await GetTokenAsync(clientApp));


Above code will get access token and pass it to Graph API client. Now you have client, simply make a call to MS Graph API:

var currentUser = await graphClient.Me.Request().GetAsync();


Don’t forget to add following using directives at top of class:

using Microsoft.Graph;

using Microsoft.Identity.Client;

using System;

using System.Configuration;

using System.Net.Http.Headers;

using System.Threading.Tasks;

The whole code looks like this:

22 code

I have attached the whole project with this article. You can download it and view/run. Please note that this code is not suitable to be used in production application.


Run application

Now you are ready to run the application. Press F5.

You will be shown a dialog to enter your Microsoft account and password:

19 sign in

Note that we did not write any code to show this popup. It is handled by Microsoft Identity package; your application will never get user name and password.

Once you enter correct Microsoft account details or your Office 365 developer account user name and password, then you will be shown permission which the application requires, and it asks for your consent:

20 consent

Remember in above code, I have written “User.Read” in “Scopes”? That’s why user is shown that this application wants to “View your basic profile”. Click “Accept” to continue.

Hurray! You will be shown logged in user’s display name!

21 result

That’s it for this article. The purpose of this article was to make you aware how you can write simple most program to connect to Office 365 using MS Graph API and fetch some data.

For more detailed code and some samples, I suggest you visit MS Graph API samples page on GitHub here. Please note that some repositories are good to be used in your production application as well.

For more on MS Graph API, read my articles here.

What is Microsoft Graph SDK?

This article is a quick overview of MS Graph SDK. Using MS Graph SDK, you can easily write code which calls MS Graph APIs to interact with Office 365 data.

What is MS Graph API?

First, let’s see what MS Graph API is. The official MS documentation defines MS Graph API as:

“You can use the Microsoft Graph API to interact with the data of millions of users in the Microsoft cloud. Use Microsoft Graph to build apps for organizations and consumers that connect to a wealth of resources, relationships, and intelligence, all through a single endpoint:”

In a nutshell, MS Graph API gives you a single REST API endpoint which you can call to interact with “almost anything” in Office 365.

To know more about MS Graph API, read my article here.

 What is MS Graph SDK?

Microsoft Graph Software Development Kit is “Microsoft Graph Client Library which allows you to call Office 365, Azure AD and other Microsoft services through a single unified developer experience.”

Using MS Graph SDK, you can quickly integrate MS Graph API in your application, so that you don’t have to write everything to deal with MS Graph API from scratch.

It provides ready-made classes and methods to be used while making Graph API calls. Please note that using MS Graph SDK is not “mandatory” if you want to code your application for MS Graph API. It just makes coding quick and easy.

What’s its availability?

MS Graph SDK is available for most leading development platforms e.g. ASP.Net, Xamarin, Android, iOS, JS, Angular, and many more. Day by day more platforms are being added.

This is the latest availability as of today:

Live availability:

Beta/Preview availability:

No SDK, only code samples available:

Keep watching the official Microsoft page here which mentions MS Graph SDK’s latest availability:

23 SDK

MS Graph SDK for .NET is available as “Microsoft.Graph” and “Microsoft.Graph.Core” NuGet packages:

24 nuget packages

Adding MS Graph SDK to your C# application

Let’s add MS Graph SDK for .NET i.e. MS Graph NuGet packages to a C# application.

Quickly create a new C# application (either console app or web app) in Visual Studio 2015/2017.

Right click project in Solution Explorer and click “Manage NuGet packages”:

10 NuGet

Go to “Browse” and type “Microsoft Graph”, press Enter key:

11 MS Graph package

Select “Microsoft.Graph” package from the result and click “Install” button on right side:

12 MS Graph package 2

It will show you “License Acceptance” dialog:

13 accept license

Note here that it will also install “Microsoft.Graph.Core” package, among others, as one of its dependencies. Click on “I Accept” button.

Output window will show success message once installation is finished.

14 success output

You have successfully added MS Graph SDK packages to your application.

You can make sure that by two ways.

Go to Solution Explorer and select “packages.config” file:

15 packages

See that “Microsoft.Graph” and “Microsoft.Graph.Core” packages are visible in config file:

16 packages file

Also, if you expand “References” in Solution Explorer then you will see Microsoft Graph references:

17 references

You will also need to install “Microsoft.Identity.Client” package as it’s required for authentication code because users are authenticated against Microsoft account.

18 Ms identity

Don’t forget to select “Include prerelease” checkbox!

That’s it! You have now successfully added MS Graph SDK and you are ready to start your coding.

To know how to write code to fetch Office 365 data using MS Graph SDK, read my article “Write your first program using Microsoft Graph SDK” here.

Testing and deploying an Office 365 add-in from network share


In this article, I will show you how you can load an Office 365 add-in from a network share for testing or live deployment.

If you are a developer who builds add-ins for Office 365, then you need to test those before deployment; and if you are developing for enterprise users then they need to access your add-ins after roll-out.

A network share (sharing your add-in from a network drive) is the easiest possible way for both of that. Read this interesting article where I show how to test and deploy Office 365 add-ins from a network share.


  • Either of:
    • Visual Studio 2015 or
    • Visual Studio 2017 (with Office Developer Tools)
    • Visual Studio Code (with Yeoman Office generator a.k.a. Yo Office!)
  • Office 365 add-in manifest (XML file)
  • A web server running your Office 365 add-in (web component)

Getting started:

If you have already created an Office 365 add-in, then you can skip this “Getting Started” section and jump directly to the next “Publish, Test & Deploy” section.

Create an Office 365 add-in using tools I have mentioned in prerequisites. Read below section for how to do that:

VS2015 office project

Give proper project name and click “Ok” button in above dialog.

Select “Task pane” from the next dialog:

VS2015 office task pane

Click next and select Excel from the next popup:

VS2015 office project finish

Click “Finish” and you are done!

  • Visual Studio Code with Yeoman Office Project Generator
    • Follow the instructions on Office Developer GitHub page here.

Publish, Test & Deploy

You can publish your Office 365 add-in web project on either IIS Server or on Azure.

For deploying web app on Azure, read another author’s article here.

For deploying web app on IIS Server, follow instructions here.

Or simply you can test it by pressing F5 from Visual Studio and let it run till you finish testing.

For showing you further instructions in this article, I have deployed my add-in web project on Azure.

All you need now is the URL on which your add-in web project is deployed. You need to configure it in the add-in manifest xml file.

Go to the solution explorer in VS 2017 and open the file location of the manifest file:

sol explorer

All you need is a copy of this manifest XML file. Copy it and paste it on any network share available for testing. I have shared it under “ExcelWebAddIn2Manifest” network share for my testing.

Open the manifest XML file in VS 2017 or any XML editor or simply Notepad, find “SourceLocation”:

source loc

You need to change the “DefaultValue” to the URL on which you deployed your add-in web app.

I have changed its value to point to my deployment URL:


That’s the only change you need to make. Now let’s add this manifest file in Excel to see our add-in working.

Open Excel, create a new blank workbook. Go to File -> Options -> Trust Center -> Trust Center Settings:

trust center

Go to “Trusted Add-in Catalogs”, enter network share path in “Catalog URL”, then click “Add catalog”:

add catalog

Select “Show in Menu” checkbox, then click “OK”:

show in menu

Once you click OK button, you will be shown following message:

restart message

Click OK and close all dialogs, then close Excel and start it again. Create a new workbook.

Go to Insert ribbon then click “Store”:


Click “Shared Folder” link, and you will see your add-in. If not, then try clicking refresh and see:

shared folder

Select the add-in and click add button.

Excel will load add-in and show you message that it has loaded:

show task pane

Click on “Show Taskpane” and your add-in will be loaded:

add in loaded

Congratulations! Your Office 365 add-in is now ready to use. You can use the above steps for testing your add-in or while deploying in live environment too.

That’s it for this article. Happy learning!



Five Golden Rules For Better Programming

In this article, I have listed the 5 golden rules for a developer, which can be practiced by any platform programmer at any experience level so as to improve their coding.

Test first programming

Write unit test first, then write your actual code. It may sound somewhat awkward, but it will help a lot.

When you write your code first, and then write your unit tests (this is what most of us do; accept it frankly!), you are writing your unit tests to justify  the code you have written. In most cases, your unit tests will always pass and you won’t be able to derive a failure scenario, and thus, there is no chance for any refactoring.

Write self-explanatory code

Code comments are fine but they need to be maintained as and when we refactor the code. As the time goes by, it becomes difficult to maintain comments per code and then comments lose their meaning.

You should have a habit of writing the code which is self-explanatory, thus requiring minimum efforts in understanding it and thus resulting in minimum comments.

Don’t ignore/suppress code analysis warnings

Most modern day IDEs now point to any non-conformance in your code as and when you build it. But as most of us do, you will ignore it or suppress it.

Take care of the warnings pointed out by these tools and fix them as and when you commit the code. Consider your coding is complete only when it has zero code analysis warning.

Don’t eat up exceptions

Write code which handles every possible error suiting the business scenario, and if any unexpected exception arises, don’t eat it up in my code, but better throw it, so that it is logged/reported somewhere in the Application and someone can take care of it later.

It is always better to gracefully handle the exception and tell the user that something bad has happened, rather than hide it behind the curtain.

Get your code reviewed by a peer

No matter how experienced a developer you may be, a second look by someone else always helps. You cannot always see your obvious/silly mistakes while someone else quickly can. It has nothing to do with the other person’s expertise or experience, it’s just human nature.

Not only this, you can also review code written by others, and you don’t have to be an expert for this. You can always learn something new reviewing others’ code, maybe a better use of some design pattern, better performing code, a new OO principle usage, etc.

This article was published on my LinkedIn page here.