Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [object-model]

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

2
votes
1answer
23 views

“Link to a Document” Content Type on non-English SharePoint

I'm following the code at https://blogs.msdn.microsoft.com/cliffgreen/2008/06/23/creating-a-link-to-a-document-item-in-a-sharepoint-document-library-programmatically/, and I'm worried about the line: ...
2
votes
2answers
209 views

Why is creating a large number of child sites becoming slower?

I need to create about 8000 sites in a site collection, based on Title and path attributes from a database table with 8000 records. I wrote a simple console based application in C# that utilizes the ...
3
votes
1answer
51 views

What could be the impact on SP Farm from those errors?

I find the below error more frequently especially with the custom application pages that are developed. i saw approx 2000 of those errors in a hour span of ULS logs. What could be the impact on SP ...
4
votes
1answer
198 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 ...
0
votes
1answer
52 views

Is there any available Object Model for document libraries and version controls?

I would like to know and understand the steps of SharePoint itself when it comes to uploading documents into a library (i. e. used as document management system) - also regarding the version control. ...
1
vote
0answers
22 views

Get workflow reports from object model

I would like to call a standard workflow report (Activity Duration Report or Cancellation & Error Report) from server-side code. This is typically done by passing in the ReportId and the workflow ...
1
vote
0answers
33 views

Programmatically Configure Auditing in Secure Store Service and Site Collection

For Auditing to be enabled, I have read that, it has to be turned on at the Secure Store Service. Also, it needs to be configured at the Site Collection Level. So, is it possible to check ...
0
votes
1answer
164 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
429 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 ...
0
votes
1answer
230 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 ...
2
votes
1answer
197 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 ...
1
vote
1answer
632 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
306 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 { ...
2
votes
1answer
5k 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
311 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
896 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 web.Lists.TryGetList("...
0
votes
2answers
277 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
177 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 ...
1
vote
0answers
906 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
575 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 ...
0
votes
1answer
82 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 ...
0
votes
2answers
72 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; ...
-1
votes
1answer
1k 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
803 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 ...
0
votes
1answer
47 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 ...
2
votes
1answer
3k 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
1answer
114 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 Microsoft....
0
votes
0answers
138 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 -...
0
votes
1answer
711 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
174 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
873 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 ...
0
votes
1answer
707 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 ...
0
votes
1answer
107 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
3k 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
228 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
1answer
689 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. ...
0
votes
0answers
660 views

Query user details using employee ID

Is there a way to fetch user details from user profile service using employee ID?
0
votes
2answers
559 views

Add file to subsite with C# knowing only URL?

I would like to use C# to add a file to a library in a subsite. I believe SPWeb will only reference the site I am on. In an ItemAdded eventreceiver, I want to use something like SPFolder ...
8
votes
2answers
797 views

SharePoint App VS Object Model

For designing solutions I am confused with whole Apps concept in 2013. What is Microsoft's guidance for when to use a SharePoint app and when to go for a traditional client or server object model ...
0
votes
0answers
390 views

TermSetItem.Terms does not load properly?

I am attempting to write a PowerShell script to extract taxonomy entries from one environment to import them into another. I'm running into a problem where one of my Term Sets' Terms property is not ...
0
votes
1answer
75 views

problem getting date time

I am using the CSOM in javascript. I have a list which contains 3 text types and 2 date types. When I use: var listEnumerator = this.listItems.getEnumerator(); var collection = listEnumerator....
2
votes
3answers
15k views

count items in a list javascript CSOM [duplicate]

I am wanting to count the number of items in my list. Using CSOM in javascript I have tried it but my code doesn't work. Where am I going wrong. Here is my code: var clientContext = new SP....
0
votes
1answer
2k views

getting data from a list sharepoint object model CSOM javascript

I have a list which I want to get information from using javascript. It doesn't show the list just certain things like how many items in the list. I am completely new to sharepoint so don't have a ...
3
votes
2answers
7k 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 ...
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" + "/" + ...
1
vote
1answer
276 views

PowerShell command to get list of documents where users x and y has permissions?

I would like to get a list of documents where user x and y has permissions. Can someone help me? I would like to do it in either PowerShell or C# code.
1
vote
1answer
1k views

Add attachment to Outlook from SharePoint Library

We have a requirement to send Emails from SharePoint with attachments from Document Library. We have been able to achieve this. But now the requirement is client want to open outlook and add ...
3
votes
2answers
139 views

Getting spuser from multiple types of information

If this sounds confusing it's because I'm al little confused on it myself. Basically I have an application (originally written by someone else but never finished) that needs to perform various actions ...
5
votes
1answer
776 views

How to programatically determine if 2013 running in '14 compatibility mode' (SP 2010)

How can you programmatically determine if a site collection is running in '14 compatibility mode' (so it looks like SharePoint 2010)?
1
vote
0answers
90 views

Files.Add fails for users with Contribute

I am using the object API to upload files. In paticular I am doing this.. SPFile file = list.RootFolder.Files.Add(filename, fileStream, author, author, DateTime.Now, DateTime.Now); The problem is ...