0% found this document useful (0 votes)
10 views8 pages

Credenca - Microsoft Graph API

This document provides a comprehensive guide on using the Microsoft Graph API to fetch data from SharePoint Online lists and integrate it into Power Apps, highlighting the advantages over native connectors. It includes prerequisites, implementation steps, error handling, and best practices for effective use. The document is intended for internal distribution within Credenca Data Solutions and contains proprietary information.

Uploaded by

amrishpawar1986
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views8 pages

Credenca - Microsoft Graph API

This document provides a comprehensive guide on using the Microsoft Graph API to fetch data from SharePoint Online lists and integrate it into Power Apps, highlighting the advantages over native connectors. It includes prerequisites, implementation steps, error handling, and best practices for effective use. The document is intended for internal distribution within Credenca Data Solutions and contains proprietary information.

Uploaded by

amrishpawar1986
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Microsoft Graph API Document

Document No: D_MicrosoftGraphAPI_01 Issue Date: 07/10/2025


Version No.: 1.0 Created By: Ira Mukadam
Amendment No.: 0 Approved By: Amrish Pawar (Manager)
Security Level: Internal / Confidential / Sensitive

Document History
CREDENCA CONFIDENTIAL AND PROPRIETARY. FOR INTERNAL DISTRIBUTION ONLY.
Disclose and distribute solely to those employees of Credenca Data Solutions that have a need to know.
Disclaimer: This document contains proprietary and confidential information which is provided "AS IS," with all faults, and without any warranties,
including, but not limited to, warranties of merchantability, performance or fitness for a particular purpose. While reasonable efforts have been
made
in the preparation of this document to assure its accuracy, Credenca Data Solutions assumes no liability resulting from technical or editorial errors
or omissions or for any damages resulting from the furnishing, performance, or use of the information contained herein.
1. Document Revisions:
Date Version No. Document Changes

October 07, 2025 1.0 Initial Draft

2. Document Approval:
Role Name Status Date of Approval

Project Manager Mr. Amrish Pawar Approved 09/10/2025

Power Apps Developer Ms. Ira Mukadam Maker 07/10/2025

3. Amendment History:
Amendment suggested
Amendment No. Amendment subsection Amendment details
by

NA NA NA NA

Page 2 of 8
Contents
1. Introduction.......................................................................................................................4
2. Pre-requisites....................................................................................................................4
3. Microsoft Graph API Overview..........................................................................................4
4. Authentication and Permissions........................................................................................5
5. Implementation in Power Apps.........................................................................................5
5.1 Building the Request Body.............................................................................................5
5.2 Encoding Request Body to Base64................................................................................6
5.3 Making the Graph API Call.............................................................................................7
5.4 Parsing Results into a Collection....................................................................................8
6. Error Handling...................................................................................................................8
7. Best Practices...................................................................................................................8

Page 3 of 8
1. Introduction

This document explains how to use Microsoft Graph API to fetch data from a SharePoint
Online list and integrate it into Power Apps.
While Power Apps provides a native SharePoint connector, it comes with certain delegation
and performance limitations when handling large datasets. By using Microsoft Graph API,
you gain:
 Greater flexibility,
 Ability to query large datasets,
 Advanced filtering and search options,
 More scalable performance.

2. Pre-requisites

Before implementing the Graph API in Power Apps, ensure the following:
 A valid Power Apps license with access to premium connectors (if required).
 Access to the SharePoint site and list.
 An Azure Active Directory App registration with delegated Graph API permissions.
 Required permissions such as [Link] or [Link].
 Basic knowledge of REST APIs and JSON formatting.

[Link] Graph API Overview

Microsoft Graph is the unified endpoint for Microsoft 365 services.


 It allows developers to query data from SharePoint, OneDrive, Teams, Outlook,
and more.
 In this scenario, it is used to fetch SharePoint list items.
Key Endpoints:
 Get Site ID:
 GET [Link]
{siteName}
 Get List ID:

Page 4 of 8
 GET [Link]
 Get List Items:
 GET [Link]

[Link] and Permissions

To access Graph API:


1. Register an app in Azure AD.
2. Grant API permissions:
o [Link] or

o [Link] (recommended for least privilege).

3. Ensure Admin Consent is granted.


4. Use [Link] inside Power Apps to call the API.

[Link] in Power Apps

5.1 Building the Request Body


In Power Apps, construct the JSON request body for the Graph API search query:
Set(varRequestBody,
"{
""requests"": [
{
""entityTypes"": [
""listItem""
],
""query"": {
""queryString"": ""Path:\""[Link] List\""""
},
""size"":""500"",

Page 5 of 8
""fields"": [
""title"",
""RefinableString00"",
""RefinableString01"",
""RefinableString02"",
""RefinableString03"",
""RefinableString04"",
""RefinableString05"",
""RefinableString06""
]
}
]
}");

5.2 Encoding Request Body to Base64


Since [Link] requires Base64 encoding, the request body is
converted as follows:
Set(VarFile,
"data:text/plain;base64," &
With({
InputText:varRequestBody,
AsciiTable:AddColumns(Sequence(2^8,1),char,Char(Value)),
B64ToBin:
Table(
{b64:"A",bin:"000000"},
{b64:"B",bin:"000001"},
...
{b64:"/",bin:"111111"}
)},
With({
BinRep:

Page 6 of 8
Concat(
AddColumns(ForAll(Split(InputText,""), {Result:
[Link]}),dec,LookUp(AsciiTable,char=Result).Value),
Concat(Sequence(8,8,-1),Text(If(And(Mod(dec,Power(2,Value))>=Power(2,Value-
1),Mod(dec,Power(2,Value))<Power(2,Value)),1,0)))&"","")
},
With({b64string:Concat(
Sequence(
RoundUp(Len(BinRep)/6,0),0),
LookUp(
B64ToBin,
bin=Mid(BinRep&Left("000000",6-Mod(Len(BinRep),6)),6*Value+1,6)
).b64&"",
""
)},
b64string&Left("====",Mod(4-Mod(Len(b64string),4),4))
)
)
));

5.3 Making the Graph API Call


Finally, make the POST request to Graph API:
Set(SearchResults,
[Link](
"[Link]
"POST",
VarFile
)
);

Page 7 of 8
5.4 Parsing Results into a Collection
You can parse results and store them into a Power Apps collection for display:
ClearCollect(
colListItems,
[Link][0].hitsContainers[0].hits
);

[Link] Handling

Common issues when calling Graph API:


 401 Unauthorized → Invalid or expired token.
 403 Forbidden → Missing permissions (Admin Consent required).
 404 Not Found → Incorrect site or list path.
Resolution:
 Validate endpoint URLs.
 Ensure correct Graph API permissions.
 Confirm Azure AD app registration.

7. Best Practices

 Use [Link] instead of [Link] for least privilege.


 Handle pagination for lists with more than 500 items.
 Cache results in Power Apps collections to reduce API calls.
 Monitor API throttling limits (429 Too Many Requests).

Page 8 of 8

You might also like