1

I want to write an Azure Function deployed inside Azure and which run on timer schedule. but i am not sure which library i should user, either:-

  1. CSOM

  2. PnP Core

what are the main differences and when you use each?

1 Answer 1

3
+100

The key differences are:

CSOM:

  • Is the client side object model for SharePoint and works with .NET Framework and .NET Standard.
  • Utilises SharePoint's client.svc endpoint
  • Maintained by Microsoft

PnP Core SDK

  • Utilises the best possible API for interacting with Microsoft 365, preferring the Microsoft Graph where possible
  • Works with modern .NET
  • Open source

It would be better to use the PnP Core SDK where possible, for a few reasons:

  1. It uses the best possible API wherever possible.

This is usually the Microsoft Graph, which Microsoft recommend you use to interact with Microsoft 365. Where the Graph doesn't have the appropriate functionality yet, PnP Core will fallback to using the SharePoint REST API or CSOM.

  1. CSOM/SharePoint REST typically use more resource units than Microsoft Graph API calls and are therefore more likely to be throttled:

"CSOM and REST don't have a predetermined resource unit cost and they usually consume more resource units than Microsoft Graph APIs to achieve the same functionality. And in addition to resource unit limits, CSOM and REST are also subject to other internal resource limits, so if applications call CSOM and REST, they may experience more throttling than the limits described in this document. We highly recommend you choose Microsoft Graph APIs over CSOM and REST APIs when possible."

Avoid getting throttled or blocked in SharePoint Online

2
  • thanks for the reply,, but can you explain why PnP will offer By using PnP Core, you'll be future proofing your app to work with newer versions of .NET while CSOM will not?
    – John John
    Jan 31, 2023 at 16:12
  • 1
    I've reworded my answer, CSOM for .NET standard seems fine for future versions of .NET Jan 31, 2023 at 16:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.