Monday, March 3, 2025

Connect SharePoint using Azure App Application/Delegate Authentication in C#

1. Connect SharePoint using Azure App Application Authentication in C#
Create Azure app and give below Application permissions. 


using Azure.Identity;
using Microsoft.Graph;

public class Program
{
    public static async Task Main(string[] args)
    {
        string tenantId = "";
        string clientId = "";
        string clientSecret = "";
        string siteId = "283f598a-6b0f-4ba5-af06-c72a0cef8f42";
        string listId = "e9609d64-1f36-45a2-8260-743998ea2cd4";
        var credential = new ClientSecretCredential(tenantId, clientId, clientSecret);
        var graphClient = new GraphServiceClient(credential);
        var items = await graphClient.Sites[siteId].Lists[listId].Items.GetAsync();
        foreach (var item in items.Value)
        {
            Console.WriteLine($"Item ID: {item.Id}, Created By: {item.CreatedBy?.User?.DisplayName}");
        }
        Console.ReadKey();
    }
}



2. Connect SharePoint using Azure App Delegate Authentication in C#

6 comments:

  1. Frostvale shares deep appreciation for deepskystacker as a reliable astrophotography stacking tool that merges multiple exposures efficiently improving signal quality while reducing noise artifacts and enhancing faint cosmic structures captured during long exposure imaging sessions for better results overall significantly.

    ReplyDelete
  2. Nexoria offers sincere appreciation for clean direnv approach to environment variable management that automatically loads project specific settings when entering directories helping developers maintain organized workflows reducing repetitive tasks and improving efficiency across multiple coding environments while supporting consistent development

    ReplyDelete
  3. Ionix offers sincere appreciation smtp4dev lightweight SMTP debugging solution that empowers developers to test email sending locally view messages instantly and troubleshoot issues without relying on production email systems improving safety speed and confidence in software development environments overall

    ReplyDelete

Featured Post

Create a Dataverse Table With Every Common Column Type Using Power Automate

Create a Dataverse Table With Every Common Column Type Using Power Automate Create a Dataverse Table With Every Common Column Typ...

Popular posts