API for interacting with SharePoint from .NET code deployed to the server.

learn more… | top users | synonyms

0
votes
1answer
27 views

Assign permissions to folder in document library from person lookup - SharePoint 2010

Let me first preface by saying that I am new to programming with the SharePoint Object Model... I have a requirement where after a list item is created, which indicates 2 individuals in a person ...
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 ...
3
votes
3answers
2k views

How can I implement SharePoint JSGrid filtering and grouping functionality?

I am working on SharePoint JSGrid. I am able to implement the sort functionality in JSGrid. Now I want to implement the grouping and filtering in my custom JSGrid. For filtering we have to attached ...
0
votes
1answer
28 views

Check user has permissions for a sharepoint site

On a SharePoint site I've created a permissions group with contribute permission level. I've added an active directory group Domain/group1 to the SharePoint group. The group has around 100 of domain ...
5
votes
2answers
3k views

How do I remove all users from an SPGroup object?

I have an SPGroup object populated, how can I remove all members from the group, so that essentially I start with a fresh group. I can't delete and recreate it, so I need a way to work with the ...
0
votes
0answers
10 views

Security exception when trying to use JavaScriptSerializer

I am trying to use the JavaScriptSerializer class in an event receiver which is part of a sandbox solution. When trying to use the class, I get a System.MethodAccessException with the following ...
10
votes
6answers
13k views

In which situation use SPSecurity.RunWithElevatedPrivileges with superusertoken?

I have given read only permisisons to a group of users. So they have no access to see listitem or any list. I have create an application page with SPGridview which binds the listitems in question. ...
1
vote
1answer
49 views

Programmatically Get Custom Lists (User Defined) Only

Is it possible to get the user defined lists (custom lists) in SharePoint 2013 object model? I am not referring to the lists created along with the site definition.
4
votes
2answers
90 views

SPWeb object will be dispose everytime or not?

I have following code in my web part. I want to know whether this property _web will create object each time whenever I use it. If yes then will it be disposed every time. private SPWeb _web { ...
1
vote
1answer
156 views

Programmatically Get Version Changes for List Item in SharePoint 2013

Is it possible to get only the changes (changed field values) from every version of a List Item in SP 2013? If so, can anyone please explain it in detail with code?
1
vote
1answer
45 views

SPLimitedWebPartManager.Dispose() vs SPLimitedWebPartManager.Web.Dispose()

SPLimitedWebPartManager references SPWeb object internally and implements IDisposable interface, therefore we need to dispose it explicitly. As I understand, we need to dispose its internal SPweb ...
2
votes
3answers
115 views

web.GetList(“Lists/TestList”) throws FileNotFound exception

I have the following code in my application. It is throwing FileNotFound exception at `web.GetList("Lists/TestList") This list exists and I am able to get the list from ...
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" + "/" + ...
0
votes
2answers
40 views

Get Web Application Using Name in SharePoint 2013

I am using the following code to get the Web Application object in SharePoint 2013. But this is causing some performance issues. Does anyone know of a better approach? Please help. SPWebApplication ...
1
vote
1answer
62 views

Can we distribute SharePoint DLLs with our application

Is my understanding of following page correct that we can distribute Microsoft.SharePoint.Client.dll and Microsoft.SharePoint.Client.Runtime.dll with our application? Like we reference these DLLs in ...
0
votes
0answers
233 views

SharePoint search Client Object Model and Server Side Object Model

So I have two Console Search which I am testing out the usage of SharePoint Search Models via visual studio 2013. I encountered an issue where EnablePhonetic and EnableNicknames does not really work ...
1
vote
2answers
161 views

SharePoint get field value as text

For JSOM we have a great method called get_fieldValuesAsText that returns formatted field value. The same value as user can see it in the list. I am really supprised that I can't find anything like ...
5
votes
2answers
13k views

How do I query a list using CAML and SPQuery?

I have a SPList but I don't need to go through everything in that list. I need to establish a CAML query so I can limit the list items. Then, go thru each item from the query result and do something. ...
1
vote
3answers
571 views

Accessed denied when attempting to permission folder using the Object Model API

I'm attempting to permission a folder using the Object Model API that is created by an ASP.NET page wrapped into a feature. I am able to create and permission the folder for users that are in the ...
7
votes
1answer
5k views

Checking existence before using GetItemById

I am getting an item by using GetItemById but I want to check before using it whether the item exists or not. I don't want to use a query as the main purpose of using GetItemById is performance. ...
0
votes
2answers
190 views

How to update one list from another, element by element

I want to update some changes in one list from another. The second list should have details of first list. First list has got elements: Contract | Worker | Day Start | Day Stop | ...
0
votes
2answers
40 views

Deleting items in object-model

How to add a new item to SharePoint list in server object-model using C#. This is my code and I want to delete just one item using listBox SPWeb web = SPContext.Current.Web; ...
0
votes
1answer
47 views

Possibility of memory leaks in this code block

I have a tool using a similar code block as follows. private void createDiscussions() { SPWeb newCommunitySite = null; try { using (SPSite site = new ...
-1
votes
1answer
302 views

Adding items in server object-model

How to add a new item to SharePoint list in server object-model using C#. This is my code and I want to add items using textboxes SPWeb web = SPContext.Current.Web; ...
0
votes
2answers
162 views

Get the title of the item in detailed view (JavaScript)

When I click on an item in a list I get to the detailed view. There I need the title of this item. I could find it in the title of the page (when you look on the tab of your browser) but I think it's ...
1
vote
3answers
2k views

Getting hold of the document sets in a library

I am sure something wrong with the following code. There are over 400 document-sets in the library and script only shows 8. Please suggest which line is messed up. (At one time I could get this work) ...
0
votes
1answer
40 views

Applying Layout to Default Homepage Using Object Model

I've This Code to Add Page from Page Layout using (SPSite site = new SPSite(w.Url)) { using (SPWeb web = site.OpenWeb()) { PublishingSite pSite = new ...
1
vote
1answer
268 views

item[“Created By”] - How can I just get the name of the user without their ID?

I'm retreiving a series of details from an item using the following (cut down to only include Created By to make this easier to read): public List<FacilitiesEntity> FetchItems(string siteName, ...
0
votes
2answers
4k views

Getting SPUser object from “Group or People” SPListItem field

I am using a Powershell and CAML query to return items from a list. The list contains a "Group or People" field in which I have not seeing how to get the email and login information of the user. I ...
0
votes
1answer
90 views

Retrieving All Sub Site with Sharepoint Object Model Error

My code: using System; using System.Web; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.SharePoint.Client; using ...
0
votes
0answers
80 views

showing data in custom asp.net from sharepoint 2013(document libs/lists)

What would be best approach to show docs or list in an asp.net page from SharePoint 2013 on premises? I would like to show documents and lists. Which one is better CSOM,Odata? With document libraries ...
4
votes
4answers
1k views

How to programmatically modify item level permissions prior to first save?

I've got a situation where there are strict permissions requirements on an a list of which I already have written a custom form. The requirement is that upon creation, based on metadata, only certain ...
3
votes
1answer
476 views

Unable to seperate normal and hidden folder such as “Forms” [SPFolder Object Model ]

While performing certain task in a console application, i am unable to separate normal folder and hidden ones such as "Forms","FormServerTemplates" etc. I am using SPFolder in the obejct model. I have ...
2
votes
2answers
1k views

Getting SPList object by Guid giving exception “List…does not exist at site with URL”

I am trying to load a drop down list with the same items that a lookup field uses. I thought it would be relatively straightforward, but the line SPList lookupList = ...
3
votes
2answers
3k views

Programmatically retrieve the MySite URL of user

Let's say that we have the SPUser object of current user - how do I programmatically retrieve his mysite URL path, for example "mydomain:8080/personal/saltarski"? Currently I do it through string ...
12
votes
3answers
35k views

Sharepoint 2010 how to get all items in a folder contained in a list?

I have a list that contains folders. Using c# and object model, how can I see if the folder contains any items, or return a collection of all the items in that folder.
0
votes
4answers
984 views

Accessing LookupFieldValue throws error

I have a lookup field on a list (header) that looks up values on the same list. I am trying to read the value out of that lookup with this code: using (SPSite site = new SPSite (mySite.ID)) { ...
0
votes
1answer
134 views

Using CopyTo() and MoveTo() to copy or move files within the same site collection

I have a Sharepoint deployment with the following hierarchy : http://myserver.com:23456/ - SiteCollection as well as root site. http://myserver.com:23456/Archive - An archive site within the site ...
0
votes
0answers
123 views

Copy list item from Prod to Dev using Powershell or Server Object model

I'm looking for the best way, either throught Powershell or the Object Model, to copy a list item from Production to Dev. The lists are identical, I just have one item that is causing an error in an ...
0
votes
1answer
292 views

SPWeb.GetListItem behavior

I am currently trying to retrive a Sharepoint item given it's URL. The URL would be an absolute URL or a relative URL. To achieve this, I am using the SPWeb.GetListItem(string url) method. I observed ...
19
votes
3answers
2k views

Feature based XML vs. Object Model: Which is better for content type development?

I've been researching a few different ways to create content types and I recently discovered that you can use the Object Model to do this. All of the examples I have found online typically use XML ...
2
votes
4answers
1k views

WCF Service @ SharePoint 2010 TimeOut

I have been developing on SP 2010 for a while now. Mostly I have been working with the Client Object Model. Though I am at a point where I need to read out the UserProfiles from inside SharePoint. ...
1
vote
1answer
2k views

Event SPListItem Recurrence Text?

Is there a way to get the text displayed for the "Recurrence" field on the View Item screen for an OOB "Event" list item through the object model? For example, I see: "Every 1 month(s) on the first ...
0
votes
1answer
404 views

How to understand SharePoint's “All Files” folder structure?

When I open SharePoint Designer, I can usually depend on using the "All Files" tab to find what i need. But I've never really understood what this thing is. I can't seem to find a similar file ...
1
vote
2answers
2k views

How do I obtain the SPWorkflow object in the event receiver?

I have a workflow event receiver which is handling the WorkflowStarted and WorkflowCompleted events. I need to obtain references to the workflow list item and the workflow object to do some additional ...
0
votes
1answer
50 views

Is there a way to use the same method to read both an SPListItem object and SPListItemVersion object

I'm using SP2010 Server with C# for development. I'm currently writing a method that will read a couple of values from each version in a document's history. Ideally I'd like to use the same method ...
1
vote
1answer
1k views

Object Model List all users with full control on a sub site in SharePoint 2013?

If I have a sub site URL and a user with Site Admin, can I list all users in that sub site that have Full Control at that level? Any C# code sample?
1
vote
1answer
55 views

remove column from showing up in document properties

Which property in the object model do I use to tell an SPField not to show up in the document properties in Office integration? I tried ShowInEditForm but that didn't work. i want my Status column to ...
0
votes
2answers
1k views

SharePoint Online: Getting Current User Information

What is the best way to get the current users information. With the UserProfileService unavailable in SharePoint Online what would be the best method for getting a users information. Client was ...
0
votes
1answer
326 views

How do I use the object model to update quota values?

Reading this doc I'm confused by the following paragraph: If you change the values for a quota template, those changes apply only to new site collections to which you apply the template. ...