0

I am trying to build a Java application which will use Microsoft Graph API in order to view files on SharePoint. Can anyone suggest any github urls or demo projects or a third party libraries available on maven

                    .
  • What is wrong with the official microsoft graph sdk for java?? https://github.com/microsoftgraph/msgraph-sdk-java – Nikolay Dec 27 '22 at 12:58

1 Answers1

0

You can start building your java application by following the doc - https://github.com/microsoftgraph/msgraph-sdk-java

You can write below code to get files on SharePoint

GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();

LinkedList<Option> requestOptions = new LinkedList<Option>();
requestOptions.add(new QueryOption("expand", "fields"));

ListItem listItem = graphClient.sites("{site-id}").lists("{list-id}").items("{item-id}")
    .buildRequest( requestOptions )
    .get();
vicky kumar
  • 563
  • 3
  • 11
  • Where should i pass my organization SharePoint url ? In auth provider I can only set client id , client secret and tenant id. Please help me with this part. Rest part i have followed on how to get list or drive , etc. – noob_programmer Dec 30 '22 at 07:35
  • In auth provider you have to add client id , client secret and tenant id and you have to write your URL in the form on graphClient.sites("{site-id}").lists("{list-id}").items("{item-id}") , I would suggest you to go with graph explorer first and try to get list items in the SharePoint , i help you to understand, thanks. – vicky kumar Dec 30 '22 at 09:50
  • Where do i pass my college url ? Https://college.sharepoint.com/sites/MySite ??? after that i got how to fetch subsites and list, etc. – noob_programmer Dec 31 '22 at 10:38