SharePoint Server-Side Object Model

learn more… | top users | synonyms

2
votes
2answers
27 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. ...
0
votes
1answer
39 views

How to clear browser cache or cookies when user logout?

I have custom signout.aspx page which is auto redirected when user session timeout expired. Problem is when user clicks the Back arrow or opens same site again, there is no prompt for authentication ...
0
votes
1answer
8 views

is either new SPSite(string url) or new SPSite(GUID guid) better than the other? how

I have cached access to either the Url or the GUID for multiple SharePoint site collections (SPSites), and I am trying to create new references to them for permissions purposes (SPSite constructor). ...
1
vote
0answers
16 views

Whether item.recycle method will trigger event receiver?

When an item.delete() methods get called it will trigger the respective item deleting and item deleted event receiver. Whether this will behave same for the item.recycle() method too.
0
votes
1answer
24 views

Failure to turn on list auditing programatically

I have a SPListEventReceiver with a ListAdded() override that responds to the creation of Document Libraries. What I am trying to do is turn on auditing for the newly created Document Library like so: ...
0
votes
3answers
230 views

How to get all the active directory users and groups in SharePoint using C# SSOM

I have two dropdown list in one of my custom webpart. I want to load all users and groups from an active directory into respective dropdown list on a form. I am making use of SSOM for developing a ...
0
votes
1answer
30 views

How to protect data of list item

As you know that Users with edit permission on List can edit List Item via CSOM or Rest API. It does not matter if the data is simple, but in case the data of list item is essential and stored with a ...
0
votes
0answers
40 views

Unable to update RichTextMode from Compatible to FullHtml

As the title says, I am unable to update the RichTextMode property of the Description field on a Calendar List. I am trying to update the field so that it supports "Enhanced Rich Text". Snipp: ...
0
votes
0answers
18 views

Change XsltListViewWebPart ListView setting

I am programmatically creating a Community Site and with that comes a XsltListViewWebPart on the Community's homepage. I am now trying to change the Selected View property from <Current view> ...
0
votes
1answer
98 views

Order Discussion Board by latest reply date else order by created date

I am trying to order a discussion list by the latest reply date, else if it doesn't have a reply order it by the thread created date. This is what I have: SPList discussionList = ...
0
votes
2answers
63 views

Adding SPNavigationNode Shows Incorrect Title

When adding a navigation node as like so: foreach (SPNavigationNode node in web.Navigation.QuickLaunch) { if (node.Title == "Parent Title") { SPNavigationNode newNode = new ...
0
votes
1answer
39 views

Allow Posts and Discussions to use same Categories lookup field

I am creating a Community site and activating the BlogContent feature on that site. There are conflicting issues, because the Community Site and the BlogContent feature both create a Lookup List ...
0
votes
1answer
173 views

Programmatically add XsltListViewWebPart to Community Homepage

As you may know, when you create a Community site, it automatically creates a discussion list which is added to /SitePages/Community Home.aspx which looks like so. I am trying to replace this with ...
0
votes
2answers
97 views

C# SSOM turn on List Rating settings

I have been using the method described here by attempting to use reflection to turn on the Rating Settings of a list. However, I get the following error: Exception Message: exception has been thrown ...
0
votes
1answer
100 views

SSOM Embed Code when inserting list item

Clicking this button in the list's ribbon, I can properly embed HTML so SharePoint doesn't strip anything out. I have some HTML that I need to insert into a list item field via C# code. How do I ...
0
votes
1answer
46 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 ...
0
votes
0answers
69 views

Access Denied reading list with RunWithElevatedPrivileges

I am trying to read a list with a user without read permissions. I am using runWithElevatedPriviliges and I get this error: Access denied. You do not have permission to perform this action or ...
0
votes
1answer
64 views

Error on web.Webs.Add, Invalid Characters

I'm currently trying to create a Sub Web on a Site. The problem I'm faced with is that for some reason I'm getting an strange error message. Additional information: ...
2
votes
1answer
3k 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?
0
votes
1answer
62 views

Looping through active directory nested security groups in SharePoint

Is there a way to loop through the nested security groups in active directory, with or without using LDAP in SharePoint?? I have tried SPUtility.GetPrincipalsInGroup but Im not geting nested groups ...
1
vote
1answer
2k 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?
0
votes
1answer
38 views

How can we display the email-id and profile picture of loggedin user on a webpart?

In SharePoint 2013, using SSOM, we need to display the email-id and profile picture of loggedin user on a webpart? What is best practice? Do I need to use SPContext.Current.User or Do I use the ...
1
vote
1answer
113 views

ICustomRouter interface >> CSOM or Server Side Object model

We are looking into a custom document route, and I know about the ICustomRouter interface. Can it be used in CSOM? The ICustomeRouter example here: ...
0
votes
0answers
129 views

Route documents to another site collection if approaching size limit

We'd like to have a Drop Off library look @ the current site size, and if it is approaching a limit, send the file to a different site within the site collection. It's kind of like a "you are ...
2
votes
1answer
672 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
210 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
2answers
931 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. ...
1
vote
1answer
667 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 = ...
0
votes
2answers
323 views

what permissions are needed for writing to uls logs?

We have creates a webpart and in the catch block we are writing logs to uls. My concern is regarding permission to write to this log. Will users with read-only access to sharepoint face no issue? ...
0
votes
2answers
308 views

How to get the root site collection programaticallty via SSON and ECMA?

We have created web application. Within this we created 2 site collection: Site collection 1 - http://pcname:3333/ Site collection 2 - http://pcname:3333/sites/sc2 Within each site collection we ...
1
vote
3answers
1k 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); ...
8
votes
2answers
140 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 ...
4
votes
3answers
11k 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" + "/" + ...
0
votes
1answer
159 views

Creating publishing pages using SharePoint Server Object Model in SP 2010

I am trying to create new pages in my publishing site(need to use a custom page layout) using SharePoint Server Object Model. I couldn't find much help on this topic from internet. Happy to have some ...
4
votes
1answer
236 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 ...