Questions tagged [ssom]

SharePoint Server-Side Object Model

Filter by
Sorted by
Tagged with
0 votes
1 answer
29 views

How to delete curent item version

I have a task to restore Document Set to its latest snapshot. Since this functionality is implemented in event receiver, I use Server Side Object Model. By now, I have managed to restore the DS ...
Furli's user avatar
  • 5
0 votes
0 answers
24 views

Managed metadata passing as a hashtable

Currently I am using the below code in order to create a new file with some metadata columns or update an existing one based on the TargetLocationURL variable. using (Stream fs = File.OpenBinaryStream(...
jimas13's user avatar
  • 317
0 votes
0 answers
22 views

The security validation for this page is invalid when updating taxonomy field

When updating from c# code behind web service a list item's taxonomy field, I get the security validation error. However, this happens only if the term that is being referenced was recently added to ...
user104117's user avatar
1 vote
0 answers
120 views

Extract files and folders from SharePoint 2013 document library to local folder

We have a SharePoint document library inside SharePoint 2013 on-premises. the document library contains around 1 TB of files and folders. now we want to extract those files and folders from SharePoint ...
John John's user avatar
1 vote
1 answer
30 views

Add file to document library, title not getting updated

var htable = new HashTable(); htable.Add("Title", "Value1"); htable.Add("OtherField", "Value"); web.Files.add(fileName, buffer, htable, true); ...
David's user avatar
  • 39
0 votes
0 answers
56 views

How to deploy an Event Receiver (C# Visual Studio Code) which writes to SQL Server Database table

I have created an empty SharePoint project Added the Event Receiver - Item Added It should do the following operations. Connect to sql database. Add the data to the database table. Close the ...
Natasha Gondi's user avatar
0 votes
1 answer
21 views

How to restore a SharePoint 2013 site to a Specific Content DB by SSOM C#?

I have a .bak file of a SharePoint site. I want to restore it back. I am doing this with below code: var targetSiteCollection = webApp.Sites; targetSiteCollection.Restore(this._siteUrl, backupFilename,...
Harsh's user avatar
  • 179
0 votes
2 answers
51 views

SharePoint CAML not returning checked out files

I have a CAML query to find documents by name within a document library, however, the checked out (drafts) documents are not found by the below query (ran with high privilege): Spquery query = new ...
EL Patron's user avatar
  • 107
2 votes
0 answers
60 views

How switch from a windowsidentity context to a context that represents a sharepoint windowsclaims user

In a Windowsservice with a delegated Windowsidentity we access Sharepoint 2016 or 2019 by using the Sharepoint server object model (SSOM) located in the "Microsoft.SharePoint.dll". The Windowsservice ...
Jesper Mandal Hansen's user avatar
0 votes
2 answers
58 views

Unable to move custom list items from one list to another using server-side object module

I have 2 list named "ActiveItems" and "ArchItems". i wrote the following code to move some items from the "ActiveItems" to the "ArchItems":- using (SPSite omsSite = new SPSite("http://****/")) //...
John John's user avatar
0 votes
1 answer
92 views

SPFolder.MoveTo is preserving the metadata for the sub-folders while reset the metadata for the root folder

I have the following console application, which moved some folders from one document library to another within the same SP 2013 site collection:- SPList sourceomslist = omsWeb.Lists.TryGetList("...
John John's user avatar
0 votes
2 answers
135 views

Improving performance for the Create/Copy files and folders (using code) inside our large document library

We have a SharePoint 2013 on-premises team site and we have a document library which have around 29,000 +++ items, and those files are structured under around 4,000 folders and sub-folder. now inside ...
John John's user avatar
1 vote
2 answers
133 views

How to read value of columns WorkflowTaskId and WorkflowListId from SharePoint Task List using C#?

I am trying to read WorkflowTaskId and WorkflowListId fields from SharePoint Workflow Task List using SSOM C# but it says column doesn't exist While I can see both columns are displayed with values in ...
Mohammed Faisal's user avatar
1 vote
0 answers
89 views

Cannot Delete content Database (having no sites) using SSOM SharePoint 2019

I'm trying to delete a content database (having no sites) using below code: _oDB.Delete(); where "_oDB" is object of SPContentDatabase and the content database exists. However, I'm getting below ...
Sohail Shaikh's user avatar
0 votes
1 answer
102 views

Cannot Create New Site Collection using SSOM SharePoint 2019

I'm trying to create a new site collection using below code: SPWebApplication webApp = new SPSite(webAppURL).WebApplication; SPSiteCollection siteCollections = webApp.Sites; ...
Sohail Shaikh's user avatar
0 votes
1 answer
77 views

SSOM - How to set a custom property value when adding web part programmatically

I want to set a custom property value when add web part programmatically. This is my code for add web part in page: using (SPLimitedWebPartManager manager = oWeb.GetLimitedWebPartManager(...
Goshky's user avatar
  • 2,048
0 votes
1 answer
23 views

Documents added through share point object model does not show up in library

Hi I am using SP Object Model to upload a document to document library as below. Once code executed, if I go site contents the library shows the new document count added. But if go to the library no ...
Kailash Sahoo's user avatar
0 votes
2 answers
277 views

Order List Using Caml Query in a text field as a number on SP 2010

How can I order a Column where the type is text, but all the values stored are numeric, I want to order it descending but considering the Column a Numeric field without changing the column type ...
Mike's user avatar
  • 245
1 vote
0 answers
38 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 ...
Mike's user avatar
  • 245
0 votes
1 answer
103 views

Access denied when trying to get SPListCollection out of SpWeb in BCS connector

I have a BCS connector. In a constructor of its service class I want to access a SharePoint list. using (var site = new SPSite("My site URL") { using (var web = site.RootWeb) { var ...
Szybki's user avatar
  • 178
2 votes
1 answer
322 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 "...
Lancelot's user avatar
  • 175
0 votes
1 answer
245 views

SPWeb object properties turn to "null reference exception"

I am currently working a Farm Solution that is supposed to work with SharePoint 2016 and I am facing something that I can't understand. Maybe someone could explain this phenomenon or point what I am ...
Lancelot's user avatar
  • 175
0 votes
1 answer
400 views

Cannot update user profile custom property through ssom

I m trying to update the user profile "State" custom property using below code but getting following error. We have even tried to restart the user profile service but it couldn't fix the issue. Any ...
savita's user avatar
  • 3
1 vote
0 answers
25 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
Divakar Kittur's user avatar
0 votes
3 answers
386 views

Check SharePoint lists are identical

Is it possible to check two SharePoint lists are identical in terms of list columns(Column names and types) programmatically?
Sivakumar Piratheeban's user avatar
0 votes
1 answer
373 views

getting all AD groups and users of a site collection

Hello everybody I am quite new to the Sharepoint, I am trying to get all the AD groups who have permissions on a sitecollection. I am able to get all the SPgroups and users using the code below in my ...
Meerza Khizar Bayeg's user avatar
1 vote
1 answer
160 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 ...
Ahmed Bouchaala's user avatar
0 votes
1 answer
451 views

Update the selected view in list view webpart using C#

Please help me to reflect the view changes to the web part pages programmatically using C# Is it possible ?
Chicago's user avatar
  • 635
0 votes
1 answer
42 views

Issue with Date difference in Event receiver, If updates is coming from JSOM and SSOM

We are adding item in list with Jsom and SSOM. Following is the scenario when item is added through SSOM , we have a date field in which date is proper. Once item is added , we have an event receiver ...
Ravindra's user avatar
  • 436
0 votes
1 answer
52 views

Set UniqueId of SPListItem

How to set UniqueId property of SPListItem programmatically using SSOM?
Slaven Semper's user avatar
-1 votes
1 answer
138 views

Check if specified user belongs to specific group or not

I have implemented a site and have added a SharePoint group called "SG_Uploader". In this group, I ONLY have one Active Directory group called "AD_L6" and there are many users in AD_L6. If a user ...
FLICKER's user avatar
  • 109
0 votes
1 answer
169 views

Sometimes the template returns null

Add-PSSnapin Microsoft.SharePoint.PowerShell $web = Get-SPWeb "http://SPWeb/sites/MyApps/Orders" $template = $web.GetAvailableWebTemplates(1033) | Where-Object {$_.Title -eq "Order_Template"} $newweb =...
Shashi B's user avatar
0 votes
1 answer
300 views

Filter SharePoint 2010 list web part

I have a Custom list view web part on a SharePoint Page. The List has a custom date field "Exam Date". I need to filter the list items based on current month, week and day. I don't want to use the ...
user1339913's user avatar
0 votes
2 answers
332 views

How to: Add dynamic server-side generated values to a masterpage

SP 2013 On premise. Publishing enabled. We use AD Groups to organize our users. These AD groups are then added to 1 or more SP groups for the purpose of audience targeting. I now have the need to hide ...
Arale's user avatar
  • 61
1 vote
1 answer
449 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 ...
Arale's user avatar
  • 61
0 votes
1 answer
70 views

What is the best Object type i can use that represent a site column of type People or Group, which can hold SPUser or SPGroup

I am working on an Event Receiver for my SharePoint farm 2013. now i have a site column of type "People or Group", and this site column can hold User Name/s OR group names. so inside my Event ...
John John's user avatar
6 votes
1 answer
775 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 ...
Aakash Maurya's user avatar
0 votes
2 answers
1k views

SPList workflowassociations is empty

I have a documents list on sharepoint 2013 associated with a simpel sharepoint designer workflow. I am able to start the workflow on the list items from a timerjob using csom code. But when trying to ...
Aktam's user avatar
  • 3
1 vote
3 answers
2k 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 ...
Debugger's user avatar
  • 1,722
1 vote
0 answers
69 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
satya's user avatar
  • 11
1 vote
1 answer
60 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.
MSA's user avatar
  • 1,155
1 vote
1 answer
38 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 ...
MSA's user avatar
  • 1,155
3 votes
1 answer
319 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 ...
Ax Learner's user avatar
0 votes
1 answer
526 views

Cannot change permissions of root web : On Using web.BreakRoleInheritance(true, false);

I am new to SharePoint programming and had written the below code to access all groups and group users from a site collection including all subsites using web.BreakRoleInheritance(true, false); . So ...
beginner's user avatar
1 vote
1 answer
202 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 ...
Darrel's user avatar
  • 53
3 votes
2 answers
540 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 ...
beginner's user avatar
0 votes
2 answers
434 views

SOM to loop in all the Sites of Site Collection

I am new to sharepoint programming I have requirement to loop all the sites of site collection which should also loop including sub-sites. Can any one help me how can I do this via Server Object ...
MSA's user avatar
  • 1,155
1 vote
0 answers
206 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
MSA's user avatar
  • 1,155
1 vote
0 answers
112 views

Rename Document in ItemAdded

im trying to rename a document in the ItemAdded event receiver with the following code: public override void ItemAdded(SPItemEventProperties properties) { properties.ListItem[...
Bernhard's user avatar
  • 303
1 vote
0 answers
22 views

Nintex Browser Control Shortened in sharepoint [closed]

My Nintex form is working fine for list and document libraries ,But when my users try to browse the attachment "Browser" option is getting Truncated as below. Can any one help me what's the issue ...
MSA's user avatar
  • 1,155