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

learn more… | top users | synonyms

1
vote
1answer
47 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
0answers
31 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 ...
1
vote
0answers
99 views

Programatically adding All Authenticated Users

I want to give all authenticated users read access to a list (that stores some configuration for a feature). "All Authenticated Users" is a special concept in SharePoint, but the implementation ...
1
vote
3answers
92 views

Can I programatically move sites or content between 2007 and 2010?

Using the SharePoint Object Model on a SharePoint 2007 environment and the remote object model to talk to a SharePoint 2010 environment would it theoretically be possible to migrate sites or content ...
1
vote
1answer
209 views

To deploy page layout with feature at the same time of adding content type, the content type Id issue

First let me describe my situation: Now I'm using object model to add two content types (inheriting Pages content type) using the FeatureActivating methode in the Feature Receiver. in the same ...
1
vote
0answers
62 views

Distinguish Event Receiver Firing From Web UI or From Code

Think of some event receiver methods like ItemAdded, ItemDeleted etc. How can I detect in my event receiver code if the item adding/deleting is being triggered from the web UI or from the object ...
1
vote
2answers
235 views

SharePoint Data Modelling Tool

I plan to develop a data model for a SharePoint application that we would like to bid out for development. Is there a data modelling tool that is preferred to be used with SharePoint, like it can ...
1
vote
1answer
133 views

Stale QuickLaunch after SPWeb.Title update and Redirect

Thanks for taking a look. I have a text box and a button on a SharePoint aspx page which will update the current SPWeb's title. The control then redirects the user to a different .aspx page in the ...
1
vote
1answer
39 views

Move discussion list to another discussion list

How to move a discussion list with all its messages to another discussion list maintaining the proper tree structure of the messages(replies)??
1
vote
0answers
152 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 ...
1
vote
1answer
349 views

Show Last Viewed date in a View

I understand enabling Auditing at a Content Type or Document Library level allows you to run reports to determine when documents are opened or downloaded (last viewed). Is there a way to show this ...
1
vote
1answer
971 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) ...
1
vote
1answer
505 views

Why are SP objects (such as SPUser) not serializable?

I tried to create some private variables that were SPUser's, but I was given an error to the tune of 'SPUser is not marked as Serializable'. Why? I know these objects contain a lot of contextual ...
1
vote
3answers
553 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 ...
0
votes
2answers
262 views

Event reciever (itemadded) sharepoint 2010

is there a way where we can get the link(editform.aspx) of item just added to the list-- in the itemadded method of the event receiver (Share Point object model)
0
votes
1answer
606 views

How to create a SPUser object from its XML representation

I have the following XML representation for a user: <pc:Person xmlns:pc="http://schemas.microsoft.com/office/infopath/2007/PartnerControls"> <pc:DisplayName>John ...
0
votes
1answer
115 views

How do I read pagecolumns from the current page

I know that I have to use SPSite site = new SPSite("SPsite Path"); SPWeb web = site.OpenWeb(); SPList contacts = web.Lists["Listname"]; if I need to get content of a List, but how do I read data ...
0
votes
3answers
392 views

How to find newly added item in the sharepoint portal?

How to find the recently added item in the share point page If the any user added the items in the custom list, library, list,Announcement, Picture library,etc......... i need to show all item that ...
0
votes
2answers
32 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 ...
0
votes
1answer
94 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 ...
0
votes
2answers
476 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
2answers
268 views

How check if a site (not site collection) has sub sites in it? [Object Model]

I am trying to figure out a way to check if a Site inside a Site Collection has sub sites in it. To get sites inside a site collection, we can use the below code. foreach (SPWeb siteobject in ...
0
votes
1answer
157 views

PowerShell version of SPWebapplication.FormDigestSettings.Enabled?

Does some one know the PowerShell equivalent version of the following SharePoint object model code: SPWebapplication.FormDigestSettings.Enabled = false;
0
votes
1answer
2k 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
1k 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
3answers
63 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 ...
0
votes
1answer
34 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 ...
0
votes
1answer
105 views

Setting permissions on a folder

2010, c# server object model I'm trying to programmatically assign permissions to specific folders in a document library (see my original post here) but I'm hung up on selecting a folder as an ...
0
votes
3answers
47 views

SPFolderCollection valid index arguments

SharePoint 2010, c# server object model, VS2012 Long story short, I'm trying to fetch a folder of a document library, create a new folder in it from an array of names, then fetch the new folder via ...
0
votes
1answer
44 views

Ghostable via Object Model

Is it possible to set a file as Ghostable/GhostableInLibrary via the Server Object Model? I don't see any properties on SPFile that seem to fit the bill. I know you can do this via an XML module, but ...
0
votes
2answers
159 views

Adding extension methods to SharePoint types

Heads up, this is very much a beginner question. My SharePoint experience is primarily with working with SharePoint designer and powershell. I've never touched Visual Studio or anything to use custom ...
0
votes
1answer
38 views

Approving document library items from Object model in WSS 2.0

What is the correct way to approve an item in WSS 2.0 through the object model? I have some code that was recently modified to auto approve items that met certain criteria by another developer. That ...
0
votes
1answer
35 views

Longest practical filter for an alert

Environment: SP2010 Enterprise SP1, Server/SQL 2008 R2, VS2012 When building alerts through object model, what is the longest or most complex CAML filter that can be applied to them? Can they be as ...
0
votes
1answer
231 views

Getting Library contents along with Folder structure [Console application using Object Model]

I am developing a console application which will get all the files in a document library and copy it to a particular location on system. I was successful in retrieving all the files within the ...
0
votes
3answers
285 views

I cant hide the Title field programatically

I am trying to hide the Title field so it does not appear in add/edit forms. I am using web templates. The title is hidden in the sitecollection but not in any of its sub sites. Below is my code. ...
0
votes
1answer
236 views

Enable-Feature powershell-command in object model

How to do Enable-SPFeature equievalent in object model. I want to enable some features (lists) in my publishing site in event receiver. For example: Enable-SPFeature announcementslist -url ...
0
votes
1answer
758 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
2answers
156 views

How to update one list from another, element by element

I want update with some changes one list from another. The secand list should have details of first list. First list has got elements: Contract | Worker | Day Start | Day Stop | ...
0
votes
1answer
131 views

Invalid URI when trying to empty recycle bin

Based on this question I wrote the following in my class for emptying the recycle bin: public static void EmptyRecycleBinItem(string siteCollection, string originalLocation, string filename) { ...
0
votes
1answer
1k views

Copying items from one list in one site to another in another site?

I have a class that I've been working on to allow me to move items in SharePoint, whilst retaining meta data. The class is as follows: public class Lists { /// <summary> /// ...
0
votes
2answers
4k views

How to add specific SharePoint Group to List permission with c#?

using (SPSite site = (SPSite)properties.Feature.Parent) { using (SPWeb web = site.OpenWeb()) { if (web != null) { web.AllowUnsafeUpdates = true; SPList list = ...
0
votes
1answer
828 views

Need Sharepoint like modal pop-up window

I need to show Sharepoint 2010 like pop-up window when clicked on a link in grid view. Once the modal pop-up displayed and user selected the Save button data base should be updated with given values ...
0
votes
1answer
101 views

difference between non-/ shared scopes

can someone point out for me the difference between shared scopes and non-shared scopes? I think one difference is that shared scopes are available in all site-collections, whereas non-shared scopes ...
0
votes
1answer
597 views

SharePoint Object Model: how to query ONLY last major version of data from Publishing Page?

I came into a situation where I wanted to use SharePoint Object Model SPSiteDataQuery to query data from Publishing Page. However, I dont want the data query based on the permission on current login ...
0
votes
1answer
123 views

Tagging documents in SharePoint

Can we tag individual SharePoint documents? If so, how can we read the tags of a document using SharePoint object model?
0
votes
1answer
1k views

how can i get Web Analytics database name with Object Model?

First let me say, that all of we doing in sharepoint is base on the object model, so i can go to Central Administration and get my "Web Analytics Service Application" Database Name and Server Name, ...
0
votes
2answers
577 views

Add site column to site content type error

var objWeb = properties.Feature.Parent as SPWeb; Guid webPublishingGuid = new Guid("94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb"); SPFeature feature = null; SPSite site = objWeb.Site; feature = ...
0
votes
1answer
155 views

SharePoint Web Part Gallery details of each web part

When using SPWeb.GetCatalog(SPListTemplateType.WebPartCatalog), it returns an SPList which of course contains a SPListItemCollection of the web parts in the web part gallery. When looping through the ...
0
votes
1answer
489 views

Re-order Content Types for a List in code

Has anyone been able to re-order content types for a list in code? If I'm given a specific content type, I want to make it the default in a list, by re-ordering the SPList.ContentTypes collection and ...
0
votes
1answer
952 views

Add an item with lookup field using object model SP2010?

Can someone please post sample code which shows how to deal with a lookup column during an item insert (using object model). Here is the basic framework for an insert: SPListItem oListItem = ...