I often face the problem that I have to interact with the Sharepoint from the outside. In this article I will give you a short overview of all existing ways to interact with Sharepoint (that I know)

Overview

Welche API ist jedoch die richtige. Hierfür bietet MS auch eine Entscheidungshilfe (Choose the right API set in SharePoint)

Remote Procedure Call Protocol (RPC)

Sharepoint REST API v1

  • Die Sharepoint REST API wurde 2010 eingeführt und mit 2013 wesentlich verändert
  • REST API von Sharepoint 2010 ist das ListData Web Service
  • Sharepoint 2013 führte die beiden /_api/lists/ und /_api/web Endpunkte ein

Sharepoint REST API 2010

Sharepoint REST API 2013

SharePoint REST service architecture
Quelle: https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service?tabs=csom

Sharepoint REST API V2

Microsoft Graph, Microsoft Graph data connect, and Microsoft Graph connectors enable extending Microsoft 365 experiences and building intelligent apps.
Quelle: https://docs.microsoft.com/en-us/graph/overview
Getting Started with Microsoft Graph and SharePoint

Sharepoint Clientseitige Bibliotheken

Sharepoint Client Object Model (CSOM)

Javascript Client Object Model (JSOM)

Datenabruf mit PowerShell

serverseitige API

  • Der direkte Datenabruf über das serverseitige API sollte wenn möglich vermieden werden, da dazu Lösungen direkt auf dem SharePoint-Server installiert werden müssen
  • Das Server Object Model ist die umfangreichste API.
  • Beispiele / Anleitungen

Beispiel: Liste alle Listen einer Seite auf:

using Microsoft.SharePoint;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharePointData {
   class Program {
      static void Main(string[] args) {
         using (var site = new SPSite("http://server/sites/site")) {
            var web = site.RootWeb;
            Console.WriteLine(web.Title);
            var lists = web.Lists;
            
            foreach (SPList list in lists) {
               Console.WriteLine("\t" + list.Title);
            }
            Console.ReadLine();
         }
      }
   }
}