Questions tagged [ssom]

SharePoint Server-Side Object Model

20
votes
2answers
413 views

ProjectPolicy.SavePolicy() : server side giving error : The collection cannot be modified

Trying to modify ProjectPolicy Properties server side is giving me an error : List<ProjectPolicy> availPolicies = ProjectPolicy.GetProjectPolicies(web); ProjectPolicy policy = availPolicies....
10
votes
2answers
162 views

How do I delimit Property bag values so search treats them as individual searchable words?

Currently I am using the property bag with values that are comma separated something like: web.AllProperties["fruits"] = "bananas, apples, oranges, tomatoes"; Currently search is treating them as ...
7
votes
3answers
22k views

Get absolute URL to listitem's default display form

I need to have an absolute URL of a listitem's display form - currently I do it the following way: On http://example.com/: item.ParentList.ParentWeb.Url.TrimEnd('/') //"http://example.com" + "/" + ...
7
votes
2answers
502 views

Using CAML Builder Is it possible to query the items from multiple list in SharePoint 2013?

I have three lists like List1, List2, List3. I need to retrieve an item based on conditions, Is this possible to query the items from multiple lists using Caml query builder tool U2U. I am not sure ...
6
votes
2answers
140 views

SPContentTypeId.Empty vs default

Is there any reason to prefer SPContentTypeId.Empty over default? Console.WriteLine(default (SPContentTypeId)); // writes 0x Console.WriteLine(new SPContentTypeId()); // writes 0x Console.WriteLine(...
5
votes
1answer
449 views

How to resolve “Your search cannot be completed because no Search service is available. Contact your administrator for more information.”?

I am working with SP2016 Farm solution. I have configured a Search Service on my farm, customized the result source too. When I use the result source in Content Search WebPart on SharePoint Page, it ...
5
votes
1answer
3k views

SharePoint 2013 Batch update list items C# SSOM

I am trying to use batch update for one of the list in SP2013 site. I am trying to run a simple batch request as follows. using (var spSite = new SPSite(siteName)) using (var spWeb = ...
4
votes
1answer
344 views

Is it possible to use SSOM for Sharepoint Online?

I know, to use SSOM it must be deployed on same farm. Is there any way to use SSOM to work with Sharepoint Online? Thank you.
4
votes
1answer
204 views

Accessing SharePoint using the object model with impersonation

I have a SharePoint web application which contains two applications. Sp.test.com => SharePoint web application, claims based authentication. Employees => Employees application, authentication with AD ...
4
votes
2answers
287 views

SPUser.Groups is empty

I have an SPUser object generated from the currently logged in user via SPContext.Current.Web.CurrentUser however user.Groups is coming back empty. I checked the group, the user is in the group. ...
4
votes
1answer
408 views

SPFarm.Local Object Being Cached in SharePoint 2013

I am experiencing an odd issue where the SPFarm.Local object is not being updated for SharePoint 2013, but it does for 2010. Basically I have some code that adds/deploys/updates SharePoint solutions ...
4
votes
1answer
2k views

Get all users who have permission to a specific folder

I am working with SharePoint 2010 . I have a folder in my SharePoint document library. I am trying to get the users who have any permission or role to that folder programmatically. But can't find a ...
3
votes
2answers
385 views

Server Object Model to get Users & Group details of Site Collection and it's site levels

I am new to programming , And seeking desperate help from you folks . Need to get all the users of Site Collection ,Even on breaking in-heritance between sites and sub-sites. Can any one help me how ...
3
votes
1answer
102 views

SP 2013 SSOM Checkin DirectoryNotFoundException

Trying to recurse through a folder and checkout or checkin all files. But i keep getting a DirectoryNotFoundException on the checkin. Oddly enough, i manually uploaded a file to the Agency folder (the ...
3
votes
2answers
2k views

Check if user profile exist programmatically

I am trying to get user profile image from user profile. Here is my code sample: SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite site = new SPSite(...
3
votes
1answer
14k views

Major Differences between CSOM and SSOM [duplicate]

I know the differences between client side and server side scripting on a web application. But when it comes to SharePoint what exactly means client side and server side?
3
votes
1answer
122 views

How i can associate an SPFieldUser to a SPGroup

I am working on developing an event receiver inside my sharepoint 2013 farm on-premises. and inside the event receiver i am trying to assign a list column to a SPGroup. what i am trying to do is ...
3
votes
1answer
159 views

Server Object Model to recursively loop through All Sites Collections and there sub-sites of Web-application

This is my First Post on SharePoint and I am new to SharePoint.I am listening lot of positive buzz on sharepoint.stackexchange , And i hope I too get the same support from you all folks. My ...
3
votes
0answers
100 views

What does it mean when a message for a thrown exception is a GUID

I noticed this unexpected entry in the trace log on one of our on-premise 2013 farms: 85c6b8ca-b2a3-4c6e-8a9f-d60d96224577 Stack trace: at Microsoft.SharePoint.SPFile.GetFileStream(...
2
votes
2answers
2k views

How do I fetch the data from list present in root web of the root site collection?

We need to populate some data on an application page. The application page is present in the layouts folder and hence is accessible via the respective site URL. There are multiple site collections. ...
2
votes
2answers
84 views

Code for Activating and Deactivating Audit Feature

I am seeking for Server Object model to Activate and deactivate the SharePoint Audit Feature. Can any one help me how can I achieve this?
2
votes
2answers
2k views

how do I update user profile property in SharePoint 2013

We are using sp2013. There is a custom user profile property with name: MyProperty (boolean). The property cannot be edited by user. I want to update the property value for current user on an ...
2
votes
1answer
692 views

Copy document library from one sitecollection to another using powershell

copy the document library with metadata from one to another site collection using PowerShell
2
votes
1answer
114 views

List Attachment

Can you give me a brief on how Attachment List is linked to a specific item and how does it work, I want to customize it to filter the attached documents
2
votes
1answer
1k views

How do I “follow site” in SharePoint with SSOM?

I haven't found that much information online about how to utilize the Social Part of SharePoint 2013 by Server Object Model. To understand and follow my question better i recommend you going to this ...
2
votes
2answers
508 views

Calendar List - CAML Query Next Two Events

I need to create a CAML query to obtain the following two events from a SharePoint 2010 calendar: To consider: There may be recurring events And exceptions to events The purpose is to show in a ...
2
votes
1answer
102 views

Web Application property bag : returned value is wrong - SharePoint 2016

We are currently encountering a strange problem with some values stored in the property bag of our Web Applications that we cannot explain. Basically, we have two Web Applications, one for the main "...
2
votes
0answers
164 views

Any SharePoint tools to convert Server Object Model Code to Powershell

Is there any tool to convert the SharePoint server object model to PowerShell?
2
votes
0answers
214 views

How to get the SharePoint Group Name based on PrincipalID

I am trying to get the name of SharePoint group based on PrincipalID, But finding no luck with below code. Can anyone help me in getting with below concern. XmlDocument xmlEventData = new ...
1
vote
3answers
2k views

How to access Root Site Collection from other site collections?

we have a user control on the master page (this masterpage is applied to all sites in the web application). User control code: SPSite spsite = new SPSite(SPContext.Current.Web.Url); ...
1
vote
1answer
1k views

Alternative to using (Event Receivers & Server-side object model) when working with Office 365 sharepoint

I have being working with on-premise sharepoint 2013. and a lot of functionalities i have been doing were implemented inside Event Receivers when item added/updated. Where inside Visual Studio 2012 ...
1
vote
3answers
796 views

Application page as home page

I am developing a SharePoint 2010 Project totaly in Visual Studio and C#. I do not want to use SharePoint Designer and configuration via browser. I need to set a LAYOUT page (application page) as ...
1
vote
3answers
389 views

How to get the site lastvisted time of the user in SharePoint 2013?

I need to get the site last visited time of the user's, and need to update that time in userprofile properties. I am not sure any api or in build functionality available. Pls suggest me some idea to ...
1
vote
1answer
40 views

Show Button only to Site Administrator

I have a asp.net button , And I would like to show only to sharepoint site administrator using Server Object Model. Can any one help me how can I do this.
1
vote
1answer
82 views

Use PowerShell on a large site to do a permissions find and replace

I've inherited a site collection that has 20,000+ subsites. I cannot connect any management tools to it like Metalogix or ShareGate and I've been told PowerShell will fix it. I hope to batch the jobs ...
1
vote
2answers
204 views

Can't access user profile in event receiver

I am trying to access a user profile property in a list item event event receiver(item adding). But I get the following error The user could not be found in the database. You must first create ...
1
vote
1answer
61 views

This row already belongs to this table while binding the SpAudit Entries

Can any one help me in knowing what's wrong in my code Because I want all the columns from Audit entries should get create in my Data Row dynamically using (SPSite mysiteCollection = new SPSite(...
1
vote
1answer
34 views

minimal rights needed to write powershell scripts

I got some CSOM scripts in a .Net Application, that I have to to move to the server, using the server object model/powershell. As our Sharepoint team has no time and skills, it was decided that I have ...
1
vote
1answer
31 views

Enabling content type management for SPList fails

I have the following code: oWeb.Update(); oWeb.Lists.Add("SampleList", "Some description", SPListTemplateType.GenericList); oWeb.Update(); oWeb.Lists["SampleList"].ContentTypesEnabled = true; ...
1
vote
1answer
9k views

How to parse the output returned from REST (/_api/)?

When we use REST we get output as xml how do we parse this via JSOM and fetch the values? Also, please provide some information on how to use this in SSOM instead of JSOM?
1
vote
1answer
1k views

Reading and writing user profile properties using SSOM

The code works. There is no error. Please let me know if this is the best practice to read/write to the user profile property in SharePoint 2013. Read: string currentUser = SPContext.Current.Web....
1
vote
1answer
317 views

SP - How to get site(name/title) from navigation?

I want to get title/Url from of site navigation in sharepoint programmatically. how to do this ? I have only Current.Site.Web.Url, but not have a child to get site with index.. using (SPSite oSite =...
1
vote
1answer
876 views

How to get the homepage / welcome page of a web with site.WebTemplate PROJECTSITE

to check if a user account has access to the homepage of a site collection, I have to get the root web's homepage. In most cases it works by using using (SPWeb web = site.RootWeb) { String ...
1
vote
0answers
12 views

SharePoint C# move attachment and keep creation values in SP 2019

We want to copy item attachments from one Item in one site collection to another item in a different site collection using C# (Server Side Object Model). Is it possible to keep or replicate the ...
1
vote
0answers
22 views

Saving files in physical location in all WFEs of the farm

I have a farm with 3 servers, 2 WFEs and one out of rotation for crawling. I need to save files in physical location in 2 WFEs through SSOM code. How can i do it? Thanks Diwakar
1
vote
1answer
57 views

DocumentSet.Import returns [Exception : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))]

I'm getting the [Exception: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))] when trying to import documentSet programmatically from a site collection document library to ...
1
vote
1answer
212 views

Check if CurrentUser is in AD group inside SharePoint Group

Here's the scenario: All users belong to an AD Group. We add that AD group to a SharePoint group. I need to determine if the user is in that SharePoint group using JavaScript. If this is not possible ...
1
vote
0answers
57 views

how to add date filter web part to web page using c# code(SSOM) in sharepoint 2010?

Please guide me on how to add date filter web part to web page using SSOM
1
vote
1answer
26 views

Unable to access Site Users and Groups using SPSecurity.RunWithElevatedPrivileges

I am unable to access the sharepoint users and groups using below code to access all the users and groups of site collections of web application including their sub-sites and child sub-sites Can any ...
1
vote
0answers
196 views

Export the user list and there corresponding permissions for the entire site collection

I am looking to export the users and there permission level at site collection level. Could any one please help me how can I do this with powershell script