Expand my Community achievements bar.

How to Retrieve Files from Sharepoint Library with AEM Custom Component | AEM Community Blog Seeding

Avatar

Administrator

BlogImage.jpg

How to Retrieve Files from Sharepoint Library with AEM Custom Component by Jakub Olszyna

Abstract

This article shows how to easily integrate your AEM component with Sharepoint and retrieve all files from specified library using Microsoft Graph API.

Requirements
1. AEM 6.5.x
2. Java 11
3. An application registered with the Microsoft Identity Platform with the http://localhost:4502/content/example/ms-graph-callback.html added as 4. the redirect URI [1]
5. AEM project to work on (i.e. created using aem-project-archetype [2])
6. A sharepoint site (i.e. https://{hostname}/{site})

Create component
First we need to create new AEM component that will display files from Sharepoint. Let’s add a simple html with a placeholder for the actual files and a corresponding js that will handle all the logic. Sharepoint site params (hostname, site and list) should be enough to define which documents our component should display.

${properties.title}



var sharepointFileList = (hostname, site, list) => {
var _init = () => {
}
_init()
}
Request user authorization
To use Microsoft Graph to read and write resources on behalf of a user, your app must get an access token from the Microsoft identity platform and attach the token to requests that it sends to Microsoft Graph.
The first step to getting an access token is to open new pop-up window and redirect the user to the Microsoft identity platform authorize endpoint with required scope. In our case it scope should at least contain Sites.Read.All to allow read-only access to users resources. The user organization is defined as the tenant and appId corresponds to the Application ID that the registration portal assigned your app.

Read Full Blog

How to Retrieve Files from Sharepoint Library with AEM Custom Component

Q&A

Please use this thread to ask the related questions.



Kautuk Sahni
Topics

Topics help categorize Community content and increase your ability to discover relevant content.

0 Replies