문제

I have an existing integration based on CSOM, which I need to move from one .NET solution to another. In the process, I was made aware that Microsoft now has a graph API. I've tried to research recommendations about whether to use the Graph API or CSOM, but I haven't found documentation that I'd thought was quite definitive enough on the issue.

The use case is fetching calendar events from O365.

Should we opt to use the Microsoft Graph API or the CSOM NuGet package? Or is there some other alternative that should be used to do the integration? I don't want to just use CSOM because we have it, if it is considered a somewhat outdated approach.

I am inexperienced when it comes to integrations with Sharepoint/O365.

도움이 되었습니까?

해결책

I don't want to just use CSOM because we have it

That's actually a very good reason to continue using it. It will allow you to replatform your app with the least amount of effort. CSOM isn't going anywhere and will continue to see development and support.

It will take longer (more money, that is) to rearchitect your application to Graph. You'll encounter issues and stumbling blocks you'll have to overcome.

On the other hand if you plan to have additional integrations with O365 services that Graph makes more sense for, then that's a possible reason to use this project as a learning experience.

So it depends, but based solely on what you've written here it would be hard to justify porting to Graph because there doesn't seem to be any benefit.

다른 팁

Before committing to Graph API, I recommend checking if all features you need are supported by it.

When it comes to SharePoint, Graph API is extremely limited in terms of features. Very roughly, Graph API covers maybe 5% of all CSOM capabilities. Probably a lot less. If your current solution just does CRUD operations with list items - then Graph can handle it.

This is a measly list of SharePoint features supported by Graph. Does it cover all you need? For what I usually do - the answer is typcally - "not even close".

Sites

  • Get site
  • Get lists
  • List subsites
  • Get item analytics

Lists

  • Get list
  • Get items
  • Create list

ListItems

  • Get item
  • Create item
  • Update item
  • Delete item
  • List versions
  • Get item analytics

So yes, that's all it can do. About 2-3 years ago, when Graph was hyped, it could only do 3-4 CRUD operations with SharePoint list items. Now, years later, we have a few more.

So, why ever use Graph then?

  • CSOM does not work with .NET Core yet. Although, it's coming within the next year, hopefully..
  • Graph has access to a lot more than just SharePoint. You can send emails, work with Planner, OneDrive, Calendar, etc. Although, number of operations there is limited as well.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top