Case

Connecting to SharePoint Online sites (O365) using Client Side Object Model. There are certain ways to connect to SharePoint Online but we frequently use below,

  • Using Client ID and Client Secret generated in SharePoint Online site.
  • Using SharePoint Online credentials.

Problem Statement

Using Client Id and Client Secret, SharePoint Online Tenant level operations are not possible without Full Control on Tenant (Full Control is not advisable/recommended)

Only way to connect to SharePoint Online Tenant is using Online Credentials.

Scenario

Connecting to Online site (https://xxx.xxx.com) using Microsoft account ([email protected]) will throw the error mentioned below.

The Application ID (AppID) for which the service ticket is requested does not exist on the system.

Stack Trace connecting from Azure portal

C# HTTP trigger function processed a request.

Solution

To connect to SharePoint Online, Online Credential should be Microsoft account.

E.g. [email protected]