Home > Software design >  SharePoint API, which to use in 2022?
SharePoint API, which to use in 2022?

Time:06-17

I'm wondering which would be the best approach in 2022 when it comes to working with SharePoint - API wise.

There seem to be a few different possible approaches: CSOM libraries, REST v1, REST v2 (beta?) and MS Graph.

I'm not sure if some of these are the in fact same and thing, just called different things on different sites that I have been reading trying to figure this out.

Can anyone shed some light over this subject - like which are the actual options at the moment, which are the ones to look into and which should be ignored due to depreciation etc?

I think I would prefer REST in some form, but obviously it depends what is offered by the APIs.

CodePudding user response:

ListData.svc The list data service should be used for SharePoint Classic functionality that isn't supported via SharePoint's Modern API's. I believe behind the scenes JSOM uses the listdata.svc. The listdata.svc is still used behind the scenes by loads of things, but as time progresses it will get phased out.

SharePoint REST v1 This is used by most people as it's mature product etc. I personally use this.

SharePoint REST v2 I haven't really used this, I'm sure I'll have used it at times for specific Modern-only functionality, but tbh, V1 vs V2 doesn't matter yet. V2 might have issues, but you can't escape unexpected issues from cropping up - you still need your solutions to be robust enough to handle unexpected failures.

MS Graph MS Graph is the future, if you can use it, you should. It is more hassle to use, as you need to set it up etc. It doesn't have all the features either, you will still need to use SharePoint APIs at times but MS Graph is always evolving. If you're making use of other M365 products, then MS Graph is the way to go. That being said, if you're asking these types of questions, you probably don't want to overcomplicate thing and should stick to regular SharePoint REST APIs until you're an expert at SharePoint REST API. The knowledge is transferable to MS Graph.

Personally, I recommend you stick with the SharePoint REST API, and I also recommend you use PNPjs/PNP PowerShell.

  • Related