SharePoint Server-Side Object Model

learn more… | top users | synonyms

-1
votes
1answer
21 views

feature is site-scoped and cannot be added to the web sharepoint 2010

Iam deploying solution to site scoped feature , and in feature activated event receiver iam writing the code to activate feature to all subsites but error is "feature is site-scoped and cannot be ...
0
votes
2answers
18 views

Programmatically Create Site Collection within a Specific Content DB or move to a specific Content DB using SP Object Model & Not PowerShell

Is it possible to specify the Content DB to which a site collection will belong while creating a Site Collection? I am using the SelfServiceCreateSite API. If not, is there a way to move a site ...
1
vote
2answers
21 views

Event Receiver SharePoint list- Is there something like properties.AfterProperties to use for text coulmns?

I tried using properties.AfterProperties in event receiver that I am using for sending updates in SharePoint list to specific e-mail addresses. So far I found that it's working well with yes/no ...
3
votes
0answers
35 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 ...
0
votes
0answers
9 views

SP07 - Create GridView with dynamic Rows in C# Class Library [duplicate]

HI everyone. I need to create GridView with dynamic Rows(add/delete) in C# Class Library on SharePoint 2007. I need this ASPX code : <asp:gridview ID="Gridview1" runat="server" ShowFooter="true" ...
2
votes
2answers
66 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 ...
0
votes
0answers
26 views

SP2007 - dynamically add/delete rows from SPGridView;

I want to create GridView like this : This is code for my UI: <asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false"> <Columns> ...
4
votes
2answers
107 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 ...
2
votes
1answer
16 views

Error creating site from template with feature with module

I created with Visual Studio a module to uploade a file. And a feature associated. Currently the site has this feature desactivated. I create a site template based on this site. When I create a ...
0
votes
3answers
58 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 ...
0
votes
1answer
44 views

Console application triggering event receiver

I have console application collecting data from SQL and either creates or updates the item in a SP list. I have added an event receiver to that list, this triggers if an item has been updated and ...
1
vote
1answer
13 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
votes
2answers
39 views

How to refresh a sharepoint list from C# console application

Is there any way to refresh a sharepoint list from C# console application. (NOTE: By refresh I mean the same that we achieve by doing a Ctrl + F5).
0
votes
1answer
16 views

SP07 - Get items from choice textbox and insert into DropDownList (-programmatically-)

I have a list(WayBill) with column(ProdyctType). I need to get this items and input then into dropDownList. This is my columnType in SP07: This is my code: protected override void ...
0
votes
0answers
23 views

Create Parallel Tasks in WorkFlow

scenario is if user raises request approval tasks should create for Group 1 and Group 2 people. if any one approves another approval task should create for Group 3. post approval of Group 3 workflow ...
0
votes
1answer
39 views

Try get attachments to SPList

I tried using this solution with the following code: using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists[ListName]; items = list.GetItems(); table = ...
2
votes
1answer
76 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 ...
2
votes
2answers
39 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
68 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
10 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
20 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
41 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
444 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
32 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
63 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
24 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
133 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
100 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
56 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
323 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
127 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
116 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
85 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
76 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
79 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
4k 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
71 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
3k 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
44 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
118 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
138 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
782 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
292 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
1k 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
721 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
348 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
345 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
145 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
13k 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" + "/" + ...