A First Look At The New Microsoft Graph Explorer – Part Three

Note: All my blogs on Microsoft Graph API can be found here.

In first two parts of my article series “A First Look at the New Microsoft Graph Explorer”, I explained about different components of Microsoft Graph Explorer. I suggest you to read those two parts first, before reading this third part for better understanding.

You can read the previous parts here:

I will continue the article series with part three where I will explain how to execute the calls to Microsoft Graph API.

The objectives of this article are:

  • Execute some Graph API GET calls using sample account
  • Look at Microsoft Graph API metadata
  • Calling beta API

Execute Graph API GET calls using sample account

Let’s look at some simple GET calls to Microsoft Graph API using the Graph Explorer.

Open the Microsoft Graph Explorer by clicking here.

Check the left section under “Authentication”.

Office Development

It says currently a sample account provided by Microsoft with some test data is being used. You can fire GET calls using this account right away.

If you see the API endpoint address bar you will notice,

Office Development

API endpoint for getting user’s profile is already loaded.

Simply click on “Run Query” button to execute the API call.

Office Development

You will see that the response area of the page is updated with something, like below.

Office Development

The status in the green background indicates that the call was successful with HTTP status code of 200 and executed in 869 mill seconds.

Look at the JSON data in “Response Preview” section.

It has some data of “user” which is the current user provided by Microsoft sample account. If you are logged in with your account, then you will see your data. I will cover the calls after login with your account later.

There is also something more.

Microsoft Graph API metadata

You might be wondering how to find out what data to expect in an API GET call response or what data to pass in an API call POST request. You can read the Graph API documentation or look at the sample queries on left side section, but there is also another way.

Look at the first line of the JSON response,

Office Development

You will see a URL for “@odata.context” property.

Copy the URL and paste in a new tab.

Office Development

You will see it loads an XML file. A big XML file. That’s the OData documentation of the Microsoft Graph API. Microsoft Graph API metadata in other words.

It specifies the different entities and actions along with properties and parameters.

Search for the following in the page- EntityType Name=”user”.

Office Development

You will find the user entity along with its properties and navigation properties. You will also find some more entities, more actions, functions. You can also see the Graph API metadata page directly here,

The following lines are taken from the Microsoft Graph website as it is:

“The metadata allows you to see and understand the Microsoft Graph data model, including the entity types, complex types, and Enums that make up the resources represented in the request and response packets.

You can use the metadata to understand the relationships between entities in Microsoft Graph and establish URLs that navigate between those entities.

Path URL resource names, query parameters, and action parameters and values are not case sensitive. However, values you assign, entity IDs, and other base64-encoded values are case sensitive.”

For the scope of this article, I will not go deeper inside this XML file and will leave it to you to explore more.

Back to the Graph Explorer

If you place your mouse cursor in the API address bar and press back space key and remove everything till “v1.0/” you will see the Graph Explorer will hint you possible API endpoints you can fire,

Office Development

Similarly, if you start typing “me/” then it will show you possible endpoints after “me”

Office Development

Now, type https://graph.microsoft.com/v1.0/organization in the address bar and press “Run Query” button, you will see the logged in user’s organization info,

Office Development

Please note that in Microsoft Graph API “me” and “organization” are the only two aliases in Microsoft Graph API i.e. these two are not the actual objects in Office 365.

If you want to test more GET calls, then you can see list of some GET calls in left section under “Sample Queries”.

Office Development

More GET calls featured scenarios can be found here on Microsoft Graph website,

Office Development

Calling API in preview

Now, let’s see how to call some Graph API endpoints which are still in preview i.e. in beta.

Change the API version to “Beta” in the version lookup,

Office Development

Copy and paste https://graph.microsoft.com/beta/me/insights/trending in the API endpoint address bar and press “Run Query” button,

Office Development

You will see the names of some documents are returned with their “weight”. These are the “trending” documents around the user and you need to write some code to convert the “weight” of each document to some meaningful representation to end user.

But the purpose of making this call is to make you understand how to fire a beta API call in Microsoft Graph Explorer.

Now change the API version to V1.0, keep the API endpoint URL same and fire the call,

Office Development

You will see it returns an error, because this endpoint is only in beta version and not yet in V1.0.

I hope you will play with Microsoft Graph Explorer and fire some more GET calls until I write the next article and we continue the journey of learning with the new Microsoft Graph Explorer.

Note: This article was first published by me on C# Corner website here.

Header image courtesy: Microsoft

Introduction to Microsoft Office 365 Developer Program

In this article, I will introduce you to MS Office 365 Developer program.

Background

The user base of MS Office 365 is increasing day by day by leaps and bounds. Microsoft needs to prepare more and more developers who work with Office 365. For this reason, Microsoft has designed the MS Office 365 Developer Program for the developers who build Office 365 solutions across desktop, web, and mobile platforms.

The MS Office 365 Developer Program can be accessed via the link https://dev.office.com/devprogram

MS Office 365

You can start registering for the developer program by clicking on “Join Now” button.

What are the benefits of MS Office 365 developer program?

The program offers many benefits. The most interesting one is one year free Office 365 developer subscription.

MS Office 365

You can also access some free online training on Office 365 too.

If you register now and till next few days, you will also get a chance to participate in a draw to win MS Ignite 2017 event.

MS Office 365

Why you should register

If you want to start with Office 365 development which is very much in demand now, then you will need a demo or test account for your programming. You may have access to Office 365 via your employer organization but that is the live organization data. You may not want to play with live data while you are in  the testing and training phase of some new programming.

Once you get the developer account, you can use it for various Office 365 related programming works, like:

  • MS Graph API
  • Office 365 API
  • Office 365 Add-ins

Microsoft is giving you a free one year subscription which you should not miss.

What you will get

Among other things described in one of the screenshots above, you will get “Office 365 Enterprise E3 Developer Trial” subscription with 5 users and US $10.40 user/month credit.

MS Office 365

Note: Shown above is a screenshot of my developer trial subscription from Office 365 Admin portal.

How to register

You can either click on “Join Now” button as shown in first screen or scroll down on the dev program home page and click on the “Join Developer Program >” button.

MS Office 365

Once you click on the “Join” button, you will be shown a registration page.

MS Office 365

Fill in your details and continue. Once you have completed the registration, you will get an email from Office Developer account.

MS Office 365

This email has a link to redeem your free Office 365 developer account. Click on the “Redeem today” link in the email to continue.

You will be shown the following screen.

MS Office 365

Fill in your details and continue.

You will see the following confirmation page.

MS Office 365

Please keep note of your user id which ends with “.onmicrosoft.com” which you will use to login to Office 365.

Office 365 Portal & Admin Portal

Once you have everything setup, you can visit the Office365 portal to access your account here.

MS Office 365

Note: The above shown image is my office 365 portal landing page. You can start using the Office 365 products right away.

You can visit the Office 365 admin portal here.

MS Office 365

You can manage users, groups, etc. from the Office 365 admin portal.

Finally, go to the billing section and check your subscription. It will show you how many number of days are left.

MS Office 365

Go now and create an Office 365 developer account, create some test data, and start programming with Office 365.

What’s stopping you?

 

Note: This article was published by me on C# Corner website here.

Header Image Credit: C# Corner

Office 365 Development With Visual Studio 2017

In this article, I will explain how one can develop for Office 365 using Visual Studio 2017.

Microsoft launched Visual Studio 2017 earlier in March this year, which is the latest IDE to develop apps and Websites and mostly anything on the Microsoft platform. I had written a complete article on how to do installation of VS2017 here and an article about its new features here. If you are new to VS2017 and haven’t tried it yet, then I suggest you  read both of my articles too.

In this article, I will write about Office 365 development with Visual Studio 2017. For brevity, I will not touch VS2017 installation in much detail, which I did in my other article. The core of this article is Office 365 development and how you can utilize powerful tools in VS2017 for all the types of Office development.

This article is a part of multiple articles series, which I plan to write on Office 365 development. Some more articles will be published here in the future.

Following are the objectives of this article,

  • How to get started with Visual Studio 2017.
  • Office 365 options while installing VS2017.
  • Introduction to Office 365 tools in VS2017.

Thus, let’s start with the installation of Visual Studio 2017.

To download VS2017, go to the Website https://www.visualstudio.com under Download Visual Studio link, choose Professional 2017, as shown below.

Visual Studio
Image source: Microsoft

Once you click on the link “Professional 2017”, it will ask you to save the installer file, click “Save”, as shown below.

Visual Studio

You will be shown a confirmation dialog. Click Yes, as shown below.

Visual Studio

Once again, the installer will ask for your confirmation. Click Continue, as shown below.

Visual Studio

Allow the installer some time to configure. After a minute or so, it will show you the screen given below, which is the new improved modularized Visual Studio 2017 installer screen.

Visual Studio

Our focus here is the Office development section, so scroll down and you will notice a checkbox area named Office/SharePoint development. Select the checkbox and you will be shown the description on right side, as shown below.

Visual Studio

This will install Office Developer Tools for Visual Studio as a default choice.

Remember that Visual Studio Tools for Office (VSTO) is optional, so don’t forget to select the checkbox for it (in Summary section on right side of Installation Window), as shown below.

Visual Studio

Alternatively, the same options can be found in Individual Components tab of Installation Window under Development activities section, as shown below.

Visual Studio

Click Install on bottom right side to continue the installation. The installer will show the progress of the installation as and when its being made.

Relax and have a cup of coffee and let the installer do the work.

Let’s also see what is the difference between Visual Studio Tools for Office (VSTO) and Office Developer Tools for Visual Studio.

Visual Studio Tools for Office (VSTO)

It was launched earlier as bridge between Office and the Studio (as claimed by Microsoft) around the start of the year 2004, targeting Office 2003 development at that time.

Visual Studio

image credit: internet source

Originally, it was launched as a replacement for VBA (Visual Basic for Applications) for working with Excel and Word, but later numerous advances and enhancements were added to it in the later versions. VSTO provides developers the tools to build on top of Office as a platform, using which you can develop add-ins for Word, Excel etc. in C#/VB.NET.

Office Developer Tools for Visual Studio

These tools were launched to provide Microsoft developers; the latest Office development features in Visual Studio. You can use Office developer tools for the following.

  • Create Office add-ins (these add-ins have a small footprint compared to VSTO add-ins).
  • Integrate Office 365 APIs into your projects.
  • Create SharePoint add-ins.

Back to VS2017 now

Check Visual Studio installer now. It may have finished the installation, which you can know from its success message. If the installation is done, you can directly open VS2017 from the installer Window or go to run prompt and type Visual Studio 2017.

Once VS2017 opens, click Create new project link to create a new project.

Visual Studio

Once the New Project Window opens inside VS2017, click Office/SharePoint node, as shown below.

Visual Studio

It gives you 3 types of new project templates, as described below.

  • If you click on Add-ins link, you will be shown the options given below.Visual Studio

You can create Word, Excel, Outlook, PowerPoint and SharePoint add-ins with this selection.

  • If you click VSTO Add-ins link, you will be shown the options given belowVisual Studio

In addition to Word, Excel, Outlook, PowerPoint add-ins, with VSTO; you can also create add-ins for Visio, Project and InfoPath. Please note that SharePoint add-ins cannot be created, using VSTO.

  • If you click SharePoint Solutions link, you will be shown the options given below.Visual Studio

You can create different types of SharePoint solutions for SP2016 and SP2013.

For the scope of this article, I covered till New Project Window in VS2017 only. What happens when you create new projects of any of these types as well as how to do the actual coding for Office development will be covered in my future posts.

Happy learning!!!

 

Note: This article was published by me on C# Corner website here.

Header Image Source: C# Corner