Get your To-Do tasks every morning on Microsoft Teams using Azure Logic Apps

I am super excited since Microsoft Graph To Do APIs are introduced at Microsoft Build 2020. We finally have APIs available in public preview on the beta endpoint of Graph.

Just a brief introduction, Microsoft To Do and Planner are the essence of tasks in Microsoft 365. To-Do helps you create a list for anything, from work assignments to school projects to groceries. It is a great tool for your personal use. On the other hand, Planner is the best place to collaborate as a team and keep your team tasks. Tasks come from everywhere, you can keep track of deadlines by adding reminders, due dates, and notes.

Wouldn’t it be nice to receive your list of assigned tasks every morning on Microsoft Teams?

Today, we will build a flow using Azure Logic Apps to automate Microsoft Teams Flow bot for sending To-Do tasks every morning at 9 AM. Here is the steps we will follow:

Logic Apps Flow

Microsoft Graph To-Do APIs in Graph Explorer

To be able to review Microsoft Graph To-Do API queries and responses with your own data, go to Microsoft Graph Explorer and login with your account from the top left corner by clicking Sign in to Graph Explorer.

Then, search for “to do” under Sample queries and select Get my to do task list. This will run the query https://graph.microsoft.com/beta/me/todo/lists and will get all the task lists as a response. Copy one of your preferred task list Id from the response.

To-Do in Graph Explorer

Let’s try to get all the tasks under your preferred task list. Change the query with the following: https://graph.microsoft.com/beta/me/todo/lists/{taskListId}/tasks. Make sure the request is GET and hit Run query. You should be able to see all tasks under the selected list as a response.

Copy this query and save somewhere, we will use this later while creating a custom connector.

To-Do in Graph Explorer

Register your app in Azure Active Directory

Go to Azure Active Directory in Azure Portal. Select App Registrations and choose New registation.

Azure Active Directory App Registration

Enter To-do-flow-app in the Name field. In the Supported account types section, select Accounts in any organizational directory and personal Microsoft accounts. Leave Redirect URI blank and choose Register to continue.

Azure Active Directory App Registration

Go to API permissions from the left hand side menu and select add a permission. Choose Microsoft Graph and Delegated Permissions. Select Task.ReadWrite and click Add permission button.

Azure Active Directory App Registration

Go to Certificates & secrets from the left hand side menu and select New client secret under the Client secrets. Choose expiry time and Add.

Azure Active Directory App Registration

Copy the secret you created and Application Id under the Overview page. Save them somewhere, we will use them while creating a custom connector.

Build Azure Logic Apps Custom Connector to consume To-Do APIs in a flow

Go to Azure Portal and create Logic Apps Custom Connector.

Logic Apps Custom Connector

On the connector configuration, fill the fields as follows:

  • Subscription: Select an Azure subscription
  • Resource Group: Create new resource group
  • Custom connector name: give a name for your custom connector
  • Select the location: Region
  • Location: Select the preferred location

Choose Review + create button to continue.

Logic Apps Custom Connector

When your custom connector is successfully created, select Edit to configure your connector.

Logic Apps Custom Connector

On the connector configuration General page, fill in the fields as follows.

  • Scheme: HTTPS
  • Host: graph.microsoft.com
  • Base URL: /

Choose Security button to continue.

Logic Apps Custom Connector

On the Security page, fill in the fields as follows.

  • Choose what authentication is implemented by your API: OAuth 2.0
  • Identity Provider: Azure Active Directory
  • Client id: the application ID you created in the previous exercise
  • Client secret: the key you created in the previous exercise
  • Login url: https://login.windows.net
  • Tenant ID: common
  • Resource URL: https://graph.microsoft.com (no trailing /)
  • Scope: Leave blank

Choose Definition button to continue.

Logic Apps Custom Connector

On the Definition page, select New Action and fill in the fields as follows.

  • Summary: Get To-Do Tasks
  • Description: Get To-Do Tasks
  • Operation ID: ToDo
  • Visibility: important

Create Request by selecting Import from Sample and fill in the fields as follows.

Select Import.

Logic Apps Custom Connector

Choose Create Connector on the top-right. After the connector has been created, copy the generated Redirect URL from Security page.

Logic Apps Custom Connector

Go back to Azure Active Directory registered app, go to Authentication tab and select Add platform, choose Web.

Logic Apps Custom Connector

Paste the Redirect URI you copied from the custom connector under the Redirect URIs. Select Access tokens and Id tokens. Click Configure to continue.

Logic Apps Custom Connector

Create Logic Apps flow to automate receiving To-Do tasks

Go to Azure Portal and create Logic App.

Logic Apps Flow

On the configuration page, fill the fields as follows:

  • Subscription: Select an Azure subscription
  • Resource Group: Create new resource group
  • Custom connector name: give a name for your logic app
  • Select the location: Region
  • Location: Select the preferred location

Choose Review + create button to continue.

Logic Apps Flow

When your Logic app is successfully created, go to your Logic app and choose Logic app designer. Select Recurrence as a trigger.

Logic Apps Flow

Configure the recurrence as follows:

  • Interval: 1
  • Frequecy: Day
  • Timezone: Select the timezone you prefer
  • Start time: YYYY-MM-DDTHH:MM:SSZ
  • At these hours: 9
Logic Apps Flow

Click plus button, go to Custom and choose To-Do Connector as a next step and select Get To-Do Tasks as an action.

Logic Apps Flow

Sign in with the same account you practiced To-Do APIs in the Graph Explorer.

Logic Apps Flow

Run the flow and see if you successfully get to-do tasks by using your Get To-Do Tasks. Copy the outputs body, we will use it in the next step.

Logic Apps Flow Results

Add Parse JSON as a next step. Place Get To-Do Tasks body under the Context. Select generate schema, paste the response body you are receiving from the Get To-Do Tasks and save.

Logic Apps Flow

Add Initialize variable as a next step. Fill the field as follows:

  • Name: Tasks
  • Type: Array
  • Value: leave blank

Add For each as a next step and fill the fields as follows:

  • Output from previous steps: value from the Parse JSON step

Add Compose in For each and fill the fields as follows:

  • Inputs: title from the Parse JSON step

Add Append to array variable in For each, and fill the fields as follows:

  • Name: Tasks
  • Value: Outputs from the Compose step.
Logic Apps Flow

Run the flow and see if To-Do Json response is successfully parsed and all task titles are added in the Tasks array.

Logic Apps Flow Results
Logic Apps Flow Results

As a next step after For each, add Post a choice of options as the Flow bot to a user and fill the fields as follows:

  • Options: Tasks from the Variables step
  • Headline: Good morning!
  • Receipent: The same account you consumed the custom connector
  • Message: Here is your tasks, have a great day! :)
  • IsAlert: Yes
Logic Apps Flow

Run the flow and see check Microsoft Teams for the related account if Flow bot is sending a message. Select one of the tasks to see the results in the Logic app flow.

Note: If you didn't add Flow in your Microsoft Teams yet, here is the steps to enable Flow in your Teams account: https://cda.ms/1BB

Teams Flow Bot Results
Logic Apps Flow Results

Finally, after user selected any of the tasks to see more details, we will post another card to share more details about the selected option.

Add For each after Post a choice of options as the Flow bot to a user and fill the fields as follows:

  • Output from previous steps: value from Parse JSON step

Add Condition in For each and fill the fields as follows:

  • Condition: And
  • Choose a value: SelectedOption from the Post a choice of options as the Flow bot to a user step
  • Operation: equal to
  • Choose a value: title from Parse JSON step
    • If true: Add Post message as a Flow bot to a user in true
      • Headline: title from Parse JSON step
      • Receipent: The same account you consumed the custom connector
      • Message: importancestatuscreatedDateTime from ParseJSON step
      • IsAlert: Yes
    • If false: leave blank
Logic Apps Flow

Here is the complete flow. Run the entire flow for testing.

Logic Apps Flow

And, the following is going to be the results after selecting one of the tasks to see the details:

Teams Flow Bot Results
Logic Apps Flow Results

Our flow is completed! You can find the source code below:

Microsoft Graph + Power Automate = M365 data with no code!

Microsoft Graph provides a single endpoint to get connected with M365 data. We know that Power Automate has many built-in MS Graph components to access Outlook, Planner, Calendar and more. But, think about calling Microsoft Graph API with custom filters from Power Automate directly! It is even more exciting and gives us more flexibility and numerous automation possibilities with no-code. Today, our scenario is to get “members” of a particular group in 3 quick steps.


Step 1: Register an application in Azure Active Directory

  • Go to Azure Portal.
  • Under Azure Active Directory, go to App Registration and click on New Registration.
  • Give a name to your app, choose the access level and hit Register button.
  • Go to API permissions tab, click on Add a permission, select Microsoft Graph and then Application permissions, add the following permissions: “Group.Read.All”, “Group.ReadWrite.All”, “User.Read.All”, “GroupMember.ReadWrite.All”, “User.ReadWrite.All”, “Directory.ReadWrite.All”.
  • After creating the permissions, we need to grant consent to the application to allow the application to access Graph API.
  • Go to Certificates & secrets and create a new client secret and copy in a notepad.
  • Finally, go to Overview tab, copy Application (client) ID and Directory (tenant) ID to a notepad, we will need it later.

Step 2: Build Power Automate Flow

  • Go to Microsoft Power Automate Portal.
  • Click on Create tab and choose Instant flow.
  • Give a flow name and choose When an HTTP request is received as a trigger of the flow, then click Create.
  • Extend When a When an HTTP request is received block and click on Use sample payload to generate schema, then add the following schema:
{
    "type" : "object",
    "properties" : {
       "groupId" : {
          "type" : "string"
       }
     }
}
  • Then click Save.
  • Click New Step and add Initialize variable with the following details:
    • Name: application_id
    • Type: string
    • Value: AAD App – Application (Client) Id
  • Click New Step and add Initialize variable with the following details:
    • Name: directory_id
    • Type: string
    • Value: AAD App – Directory (Tenant) Id
  • Click New Step and add Initialize variable with the following details:
    • Name: secret
    • Type: string
    • Value: AAD App secret
  • Click New Step and add HTTP with the below details:

Step 3: Test the Flow with Microsoft Graph Explorer and Postman

  • Go to Microsoft Graph Explorer.
  • Sign-in with your account.
  • Find all groups under my organization under Sample queries and click on it.
  • Copy one of the group ids for the testing purposes, we will use it in.
  • You may use Postman for testing purposes, and specify the following details:
    • Method: Post
    • Endpoint: copy it from the first step of your flow (When a HTTP request is received)
    • Header:
      • Key: Content-type
      • Value: application/json
    • Body: { “groupId” : “copied-groupid-from-GraphExplorer“}
  • Run test from Power Automate and send the post request from Postman.

After the successful flow, we should receive the output with all the members’ information in Json format under HTTP block.

Cheers.

– Ayca

Microsoft Graph Toolkit: gather together your Office 365 in one app

Hey there! Today, we will work on an ASP.NET Core MVC web app with the power of Microsoft Graph Toolkit. Our purpose is to enable:

  • Microsoft identity platform authentication
  • the agenda from Outlook Calendar
  • the tasks from Planner
  • e-mails from Outlook

If you never heard of Microsoft Graph Toolkit before, it is a powerful collection of reusable web components that enables accessing Microsoft 365 data with just couple lines of code! Believe it or not, Microsoft identity platform authentication can be implemented in seconds.

This web app will be a quick scenario to try out Microsoft Graph Toolkit!

You can get the source code from here .


Create ASP.NET Core MVC web app in Visual Studio Code

  • Open the Terminal in Visual Studio Code (Ctrl+Shift+`)
  • Then, create a new folder for the project
PS C:\Users\user> cd Desktop
PS C:\Users\user\Desktop> mkdir GraphToolkitNetCore
  • Create ASP.NET Core MVC app
PS C:\Users\user\Desktop> dotnet new mvc
PS C:\Users\user\Desktop> cd GraphToolkitNetCore
  • The app is created successfully! Now, click on “Open Folder” to open your project folder.
  • Press F5 to run the project
  • Our project is working fine. Before we start building our app with Microsoft Graph Toolkit, let’s go to Properties > launchSettings.json and set http://localhost:8080to applicationUrl

Register an app in Azure Active Directory

  • First thing first, go to Azure Portal
  • Under Azure Active Directory, go to App Registration and click on New Registration
  • Give a name to your app
  • Choose the access level
  • Choose Web and place http://localhost:8080 as a Redirect URI
  • Go to Authentication tab
  • Then, check Access tokens and ID tokens
  • Finally, go to Overview tab
  • Copy Application (client) ID to a notepad, we will need it later

Setup Index.cshtml

  • Go to Index.cshtml and add a row and three columns inside the row
<div class="row" id="content">
    
    <div class="column" id="one"></div>
    <div class="column" id="two"></div>
    <div class="column" id="three"></div>
    
</div>
  • Copy below additional css to site.css under wwwroot>site.scs
/* Main content */
#content, html, body {
  height: 98%;
}
#one {
  float: left;
  width: 33%;
  background:transparent;
  height:500px;
  overflow: hidden;
}
#one:hover {
  overflow-y: auto;
}
#two {
  float: middle;
  width: 33%;
  background: transparent;
  height: 500px;
  overflow: hidden;
}
#two:hover {
  overflow-y: auto;
}
#three {
  float: left;
  width: 33%;
  background: transparent;
  height: 500px;
  overflow: hidden;
}
#three:hover {
  overflow-y: auto;
}
/*Email*/
.email {
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
  padding: 10px;
  margin: 8px 4px;
  font-family: Segoe UI, Frutiger, Frutiger Linotype, Dejavu Sans, Helvetica Neue, Arial, sans-serif;
}
.email:hover {
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
  padding: 10px;
  margin: 8px 4px;
}
.email h3 {
  font-size: 12px;
  margin-top: 4px;
}
.email h4 {
  font-size: 10px;
  margin-top: 0px;
  margin-bottom: 0px;
}
.email mgt-person {
  --font-size: 10px;
  --avatar-size-s: 12px;
}
.email .preview {
  font-size: 13px;
  text-overflow: ellipsis;
  word-wrap: break-word;
  overflow: hidden;
  max-height: 2.8em;
  line-height: 1.4em;
}
a.navbar-brand {
  white-space: normal;
  text-align: center;
  word-break: break-all;
}

Let’s start working with Microsoft Graph Toolkit

Login

  • Go to Home>Index.cshtml
  • Implement MSAL provider in Index.cshtml
  • Make sure it is placed under the welcome message
<script src="https://unpkg.com/@@microsoft/mgt/dist/bundle/mgt-loader.js"></script>
<mgt-msal-provider client-id="[Client-id]"></mgt-msal-provider>
<mgt-login></mgt-login>
  • Paste Application (client) ID that you copied earlier from Azure Active Directory
  • Press F5 to run your application
  • Click on sign in button and login with your account
  • Accept to permission request
  • When the authentication is completed, you should see your details in the page

Get E-mails

  • Use mgt-get to get user’s e-mails. Implement below code as column 1 in Index.cshtml
       
<mgt-get resource="/me/messages" version="beta" scopes="mail.read" max-pages="1">
     <template>
        <div class="email" data-for="email in value">
            <h4><mgt-person person-query="{{email.sender.emailAddress.address}}" show-name person-card="hover"></mgt-person></h4>
             <h3>{{ email.subject }}</h3>
             <div data-if="email.bodyPreview" class="preview" innerHtml>{{email.bodyPreview}}</div>
             <div data-else class="preview">email body is empty</div>
        </div>
      </template>
      <template data-type="loading">loading</template>
      <template data-type="error">{{ this }} </template>
</mgt-get>  
  • Press F5 to run the app, you should be able to see the emails

Agenda

  • Use mgt-agenda to get a user or group calendar. Implement below code as column 2 in Index.cshtml
<mgt-agenda group-by-day></mgt-agenda>
  • Then, press F5 to run the app. You should be able to see the agenda on the right side of the e-mails

Tasks

  • Use mgt-tasks to get a user or group calendar. Implement below code as column 3 in Index.cshtml
<mgt-tasks></mgt-tasks>
  • Press F5 to run the app, you should be able to see the tasks on the right side of the agenda

Final version of Index.cshtml will look like below:

@{
    ViewData["Title"] = "Home Page";
}
<div class="text-center">
    <h1 class="display-4">Welcome</h1>
    <script src="https://unpkg.com/@@microsoft/mgt/dist/bundle/mgt-loader.js"></script>
    <mgt-msal-provider client-id="[Client-id]"></mgt-msal-provider>
    <mgt-login></mgt-login>
</div>
<div class="row" id="content">
     
    <div class="column" id="one">  
        <mgt-get resource="/me/messages" version="beta" scopes="mail.read" max-pages="1">
            <template>
                <div class="email" data-for="email in value">
                    <h4><mgt-person person-query="{{email.sender.emailAddress.address}}" show-name person-card="hover"></mgt-person></h4>
                        <h3>{{ email.subject }}</h3>
                        <div data-if="email.bodyPreview" class="preview" innerHtml>{{email.bodyPreview}}</div>
                        <div data-else class="preview">email body is empty</div>
                </div>
            </template>
            <template data-type="loading">loading</template>
            <template data-type="error">{{ this }} </template>
        </mgt-get>   
    </div>
    <div class="column" id="two">
        <mgt-agenda group-by-day></mgt-agenda>
    </div>
    <div class="column" id="three">
        <mgt-tasks></mgt-tasks>
    </div>
     
</div>

Our app is ready! As a result, we have our e-mails, agenda and tasks in one place. I hope you enjoyed using Microsoft Graph Toolkit. You can get the source code from here.

Let me know about your experience or if you have any feedback!

If you are interested in learning more about Microsoft Graph, check out the related posts.

Microsoft Graph API Custom Connector for Power BI

Hello there, developers! Today, we will build Microsoft Graph API custom connector for Power BI by using M Language. For those who have never heard M Language before, here is a quick ramp-up video:

Deep Dive into the M Language

In this scenario, our purpose is to build a custom connector to get Office 365 data via Graph API and use it as a data model in Power BI. So, we will be focusing on getting Microsoft Teams’ all provisioned team list with members through the connector.

Lets start with pre-requisites

Create AAD Registered Graph Application

Login Azure Portal and go to Azure Active Directory on the left side of the menu, then select App registrations and create New registration.

Give a name to your app, select preferred supported account type for your organization.
Make sure to select Public client/native (mobile/desktop) for Redirect URI and place the following redirect URL: “https://oauth.powerbi.com/views/oauthredirect.html“, then click register.

Once our app is registered, go to API Permissions > Add a permission and choose Microsoft Graph.

Select below permissions below for both Delegated Permissions and Application Permissions:

User.Read
User.Read.All
User.ReadWrite.All
Group.Read.All
Group.ReadWrite.All

Then, click Grant Admin Content for -your organization-.

Finally, go to Overview from the left side of the menu and copy Application (client) ID to a notepad. We will need this id later.

Build the connector

After successfully registering the app in Azure Active Directory, we are ready to create a Data Connector Project in Visual Studio.

  • Add Registered App Client ID in MyGraphConnector project

    As you already copied your Application (Client) ID to a notepad, go ahead and save it as client_id.txt file.
    Add your existing client_id.txt file in MyGraphConnector project, rename and remove txt extension from the file name.
    Finally, click on client_id and change the Build Action setting from Properties as Compile.

  • Configure OAuth for Graph API in MyGraphConnector.pq

    Let’s set the variables first:
section MyGraphConnector;
// TODO: make sure to set AAD client ID value in the client_id file
client_id = Text.FromBinary(Extension.Contents("client_id")); 
redirect_uri = "https://oauth.powerbi.com/views/oauthredirect.html";
token_uri = "https://login.microsoftonline.com/organizations/oauth2/v2.0/token";
authorize_uri = "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize";
logout_uri = "https://login.microsoftonline.com/logout.srf";
windowWidth = 720;
windowHeight = 1024;

Define Registered App scope:

scope_prefix = "https://graph.microsoft.com/";
scopes = {
   
    "Group.Read.All",
    "Group.ReadWrite.All",
    "User.Read",
    "User.Read.All",
    "User.ReadWrite.All"
  
};
Value.IfNull = (a, b) => if a <> null then a else b;
GetScopeString = (scopes as list, optional scopePrefix as text) as text =>
    let
        prefix = Value.IfNull(scopePrefix, ""),
        addPrefix = List.Transform(scopes, each prefix & _),
        asText = Text.Combine(addPrefix, " ")
    in
        asText;

OAuth Implementation:

// StartLogin builds a record containing the information needed for the client
StartLogin = (resourceUrl, state, display) =>
    let
        authorizeUrl = authorize_uri & "?" & Uri.BuildQueryString([
            client_id = client_id,  
            redirect_uri = redirect_uri,
            state = state,
            scope = "offline_access " & GetScopeString(scopes, scope_prefix),
            response_type = "code",
            response_mode = "query",
            login = "login"
        ])
    in
        [
            LoginUri = authorizeUrl,
            CallbackUri = redirect_uri,
            WindowHeight = 720,
            WindowWidth = 1024,
            Context = null
        ];
// FinishLogin is called when the OAuth flow reaches the specified redirect_uri. 
FinishLogin = (context, callbackUri, state) =>
    let
        // parse the full callbackUri, and extract the Query string
        parts = Uri.Parts(callbackUri)[Query],
        // if the query string contains an "error" field, raise an error
        // otherwise call TokenMethod to exchange our code for an access_token
        result = if (Record.HasFields(parts, {"error", "error_description"})) then 
                    error Error.Record(parts[error], parts[error_description], parts)
                 else
                    TokenMethod("authorization_code", "code", parts[code])
    in
        result;
// Called when the access_token has expired, and a refresh_token is available.
Refresh = (resourceUrl, refresh_token) => TokenMethod("refresh_token", "refresh_token", refresh_token);
Logout = (token) => logout_uri;
// code:       Is the actual code (authorization_code or refresh_token) to send to the service.
TokenMethod = (grantType, tokenField, code) =>
    let
        queryString = [
            client_id = client_id,
            scope = "offline_access " & GetScopeString(scopes, scope_prefix),
            grant_type = grantType,
            redirect_uri = redirect_uri
        ],
        queryWithCode = Record.AddField(queryString, tokenField, code),
        tokenResponse = Web.Contents(token_uri, [
            Content = Text.ToBinary(Uri.BuildQueryString(queryWithCode)),
            Headers = [
                #"Content-type" = "application/x-www-form-urlencoded",
                #"Accept" = "application/json"
            ],
            ManualStatusHandling = {400} 
        ]),
        body = Json.Document(tokenResponse),
        result = if (Record.HasFields(body, {"error", "error_description"})) then 
                    error Error.Record(body[error], body[error_description], body)
                 else
                    body
    in
        result;

Graph API Connector Implementation:

//Graph API URL to get all provisioned team list with members 
url= "https://graph.microsoft.com/beta/groups?$expand=members&$filter=resourceProvisioningOptions/Any(x:x eq 'Team')";
//
// Exported function(s)
//
[DataSource.Kind="MyGraphConnector", Publish="MyGraphConnector.UI"]
shared MyGraphConnector.Feed = () =>
    let
        source = OData.Feed(url, null, [ ODataVersion = 4, MoreColumns = true ])
      
      in
        source;
  
//
// Data Source definition
//
MyGraphConnector = [
    TestConnection = (dataSourcePath) => { "MyGraphConnector.Feed" },
    Authentication = [
        OAuth = [
            StartLogin=StartLogin,
            FinishLogin=FinishLogin,
            Refresh=Refresh,
            Logout=Logout
        ]
    ],
    Label = "My Graph Connector"
];
//
// UI Export definition
//
MyGraphConnector.UI = [
    Beta = true,
    ButtonText = { "MyGraphConnector.Feed", "Connect to Graph" },
    SourceImage = MyGraphConnector.Icons,
    SourceTypeImage = MyGraphConnector.Icons
];
MyGraphConnector.Icons = [
    Icon16 = { Extension.Contents("MyGraphConnector16.png"), Extension.Contents("MyGraphConnector20.png"), Extension.Contents("MyGraphConnector24.png"), Extension.Contents("MyGraphConnector32.png") },
    Icon32 = { Extension.Contents("MyGraphConnector32.png"), Extension.Contents("MyGraphConnector40.png"), Extension.Contents("MyGraphConnector48.png"), Extension.Contents("MyGraphConnector64.png") }
];

  • Update MyGraphConnector.query.pq
MyGraphConnector.Feed()

  • Run the project

Run the application in Debug mode. You should be able to receive below app:

Select your Credential Type as OAuth2, and paste your accessToken for the login url https://login.microsoftonline.com/organizations/oauth2/v2.0/token. (To learn how to get accessToken: https://docs.microsoft.com/en-us/graph/auth-v2-user)

Click Login, then type your credentials. After the successful login, click on Set Credential. You can go to Credentials tab to check if your credentials set properly.

Finally, press CTRL + F5 to get the data with connector.

  • Create MyGraphConnector.mez package

    If your app is successfully getting the data as above, let’s run the project in Release mode to create release package.

Copy your MyGraphConnector.mez from
[Your Project Folder]\MyGraphConnector\MyGraphConnector\bin\Release.

Paste it under
C:\Users\[Your User Name]\Documents\Power BI Desktop\Custom Connectors.

Test your connector in Power BI Desktop

Open your Power BI Desktop and select Get Data, click More. MyGraphConnector.Feed (Beta) should appear under Online Services. Select and connect.

Sign in with your credentials and connect.

All provisioned teams list with members should appear in Power BI as data table.


Below is the list of all properties we are able to get with the following Graph API:

graph.microsoft.com/beta/groups?$expand=members&$filter=resourceProvisioningOptions/Any(x:x eq ‘Team’)


You can get the source code from here: https://github.com/aycabas/Graph-API-Custom-Connector. I hope you find the post useful. Let me know about your experience, share your questions and comments below.

Cheers!