How C# Server side object modal work internally.

Amit 731 Reputation points
2020-10-26T12:32:17.47+00:00

Hi,
I just wonder what happened behind the scenes when I write below in my code:

SPSite siteCollection = new SPSite(SiteCollectionURL);

Is it internally sending an HTTP request or what? If sending an HTTP request will their performance will be the same as in CSOM because we are using HTTP there as well.

I didn't find any article on what actually happened internally when we use SSOM.

Any explanation will be highly appreciated.

This is my first question to this forum. Not sure if this is the right platform to ask.

SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,604 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,934 questions
{count} votes

Accepted answer
  1. Trevor Seward 11,701 Reputation points
    2020-10-26T15:24:43.727+00:00

    For SSOM, no HTTP request in sent in that particular example. It accesses the object model directly via the SharePoint binaries.

    CSOM may indeed be faster as it is loading fewer properties. As you're probably familiar with CSOM, you need to request (many of the) properties in order to view them, otherwise it only returns a minimal set. SSOM, on the other hand, not only includes all properties that CSOM has access to but additional properties that are server-side only which CSOM doesn't have access to.

    All-in-all it depends on scale. If you're parsing every Site Collection or every SPWeb in a farm with tens of thousands of sites, in SSOM that may be quite slow or you need to think about multi-threading and so forth.


2 additional answers

Sort by: Most helpful
  1. Amos Wu-MSFT 4,051 Reputation points
    2020-10-27T02:17:44.943+00:00

    No http request is sent when you use SPSite siteCollection = new SPSite(SiteCollectionURL).This is just calling the SPSite constructor and then generating the site collection object.
    Compared with CSOM, SSOM has more attributes and higher authority to operate SharePoint farm.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. sadomovalex 3,631 Reputation points
    2020-10-27T15:12:59.97+00:00

    Basic server object model generates calls to underlying Sharepoint content and config databases. And it can be used only on servers which belong to Sharepoint farm you try to access (i.e. you can't run it on server which is not member of this SP farm).

    From other side CSOM generates http requests under the hood - it calls SP web services running on remote SP machine, this web service gets needed data from Sharepoint content/config database and returns to the remote caller. It is possible to use CSOM both for local and remote SP servers.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.