5

When developing a webpart for deployment as a farm solution is it better to use the Sharepoint server context Microsoft.Sharepoint? Or is it a better practice to use the Microsoft.Sharepoint.Client and use Client Context to access list items etc?

In testing both seem to work, I'm just wondering if one has an advantage over the other.

7

I think if you have no limitation on using the server object model, that would be the best option.

In my opinion, these are the advantages:

  • Better performance
  • Code more "ordered"
  • Compiled code
  • Simpler to use
  • Elevated privileges
  • More classes

Of course it is an opinion and depends a lot on each case. But in general terms, if I have no limitations, I would work with the server object model.

  • All of those are great points, I've used client context several times but its usually when I'm developing a console application that can be ran from any location. I'm guessing with server context you don't have to continually Load and execute queries. Thanks for the response =) – Brad Fortner Jun 15 '17 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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