In SharePoint, SSOM stands for "Server-Side Object Model." It is a programming model that allows developers to access and manipulate the data and functionality of a SharePoint site from custom code. SSOM provides a set of classes, methods, and properties that can be used to perform a wide range of tasks, such as creating and modifying lists and documents, managing users and permissions, and querying data stored in a SharePoint site. SSOM code is typically executed on the server, and it can be used to build custom applications, add-ins, and other solutions that integrate with SharePoint.
Below is the list of classes used in the SharePoint Server Object Model
- SPFarm
- SPWeb
- SPSite
- SPList
- SPNavigationNode
- SPUser
- SPWebApplication
- SSOM is one of several ways to access and work with SharePoint data and functionality. Other options include the Client-Side Object Model (CSOM) and the REST API.
- SSOM is based on the .NET Framework, and it uses the managed code of the Common Language Runtime (CLR) to execute. This means that SSOM code must be written in a .NET language, such as C# or VB.NET.
- SSOM code can be executed from a variety of environments, including console applications, Windows Forms and WPF applications, ASP.NET web applications, and Windows PowerShell scripts.
- SSOM provides a rich set of objects and methods for working with SharePoint data and functionality. For example, you can use SSOM to create and modify lists and libraries, manage users and groups, and query data using CAML (Collaborative Application Markup Language).
- SSOM code can be deployed and executed in a number of ways, including via custom solutions deployed to the server, event receivers, timer jobs, and more.
Here are a few more points about SSOM in SharePoint:
SSOM is typically used when you need to perform tasks that are too complex or resource-intensive to be done using client-side technologies such as JavaScript or the REST API. For example, if you need to perform a large number of data operations or perform operations that require elevated permissions, SSOM may be a good choice.
One of the advantages of using SSOM is that it provides a rich set of objects and methods that are specific to SharePoint. This can make it easier to work with SharePoint data and functionality compared to using more generic technologies such as the REST API.
SSOM code is executed on the server, which means that it can be more efficient than client-side technologies that require data to be transferred back and forth between the client and server. However, this also means that SSOM code can be more difficult to debug, since it is not running in the context of a web browser.
SSOM code is compiled and runs in a trusted environment, which means that it has access to all of the resources and functionality of the server. This can be both an advantage and a disadvantage, as it means that SSOM code has the potential to be more powerful and flexible, but it also means that it has the potential to cause more problems if it is not well-written or used correctly.
Here is a simple example of how you might use SSOM to create a new list in a SharePoint site:
This code creates a new instance of the "SPSite" class, which represents a top-level site in a SharePoint site collection. It then uses the "OpenWeb" method to get a reference to the root "SPWeb" object of the site. Finally, it creates a new list using the "Add" method of the "Lists" collection, and sets the "OnQuickLaunch" property to "true" to add the list to the quick launch navigation of the site.
Here is another example of how you might use SSOM to retrieve and display a list of all the lists in a SharePoint site:
This code creates a new instance of the "SPSite" class, and then uses the "OpenWeb" method to get a reference to the root "SPWeb" object of the site. It then uses a "foreach" loop to iterate through the "Lists" collection of the "SPWeb" object, and prints the title of each list to the console.
Here is another example of how you might use SSOM to retrieve and display the names of all the users in a SharePoint site:
This code creates a new instance of the "SPSite" class, and then uses the "OpenWeb" method to get a reference to the root "SPWeb" object of the site. It then uses a "foreach" loop to iterate through the "SiteUsers" collection of the "SPWeb" object, and prints the name of each user to the console.
Another example of how you might use SSOM to create a new document library in a SharePoint site:
This code creates a new instance of the "SPSite" class, and then uses the "OpenWeb" method to get a reference to the root "SPWeb" object of the site. It then retrieves the "ListTemplate" object for a document library, and uses the "Add" method of the "Lists" collection to create a new document library based on this template. It then sets the "OnQuickLaunch" property to "true" to add the library to the quick launch navigation of the site.
Example of how you might use SSOM to retrieve and display the properties of a list item in a SharePoint list:
This code creates a new instance of the "SPSite" class, and then uses the "OpenWeb" method to get a reference to the root "SPWeb" object of the site. It then retrieves a reference to the "SPList" object for a list with the title "My List", and gets the first item in the list using the "Items" collection. It then iterates through the fields of the item, and prints the internal name and value of each field to the console.
Example of how you might use SSOM to retrieve and display the permissions of a list in a SharePoint site:
This code creates a new instance of the "SPSite" class, and then uses the "OpenWeb" method to get a reference to the root "SPWeb" object of the site. It then retrieves a reference to the "SPList" object for a list with the title "My List", and iterates through the "RoleAssignments" collection of the list. For each role assignment, it prints the name of the member (i.e., the user or group) and the roles that have been assigned to them.
No comments:
Post a Comment
Thanks!