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

learn more… | top users | synonyms

1
vote
2answers
331 views

Powershell calling custom code has SPWeb.CurrentUser = null (in certain cases)

I have a custom assembly which contains code to setup Variations for a SharePoint 2010 Publishing site. This code is based off a blog post from Waldek I have a PowerShell script in which I create a ...
1
vote
1answer
741 views

Programmatically enumerating Web Part Zones of a Publishing Page Layout

I have a situation where a class I have is passed a PublishingPage instance and I want to enumerate any and all web part zones that are used in the Layout Page for this page. This is proving tough. ...
1
vote
1answer
622 views

Custom ECB dropdown menu API?

In 2010 (or 2007) is there a server control that is responsible for rendering of ECB menus? For example, if I wanted to create a custom UI for a Document Library (NOT using XSL/DataViewWebPart/etc), ...
1
vote
2answers
1k views

Can I export a SharePoint 2007 list to an Excel file subdivided into separate worksheets?

We have a SharePoint 2007 deployment which will have a substantially large document library. My client wants the ability to export this library to an Excel spreadsheet, but specifically wants the ...
1
vote
1answer
15 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 ...
1
vote
1answer
84 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
48 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
156 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
120 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
222 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
66 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
1answer
145 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
180 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
414 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
1k 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
550 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
561 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
267 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
3answers
69 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
643 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
116 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
403 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
60 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
2answers
566 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
324 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
164 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
1answer
15 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 ...
0
votes
1answer
47 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?
0
votes
3answers
430 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
102 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
2answers
357 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
142 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
2answers
138 views

2010 - SPFolderCollection not updating with new items

2010 Enterprise, VS2012, c# server-side Here's the situation: I have a method that gets an SPFolderCollection object from a document library. It then loops through the list checking for a specific ...
0
votes
1answer
50 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
190 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
39 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
36 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
248 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
1answer
246 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
2answers
158 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
141 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
2k 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
899 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
109 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
575 views

Adding column in Status indicator

I have requirement that adding one more field in the Status indicator list view programmetically.is there way to extend the Staus indicator list using programmetically?.How can i acheive this? Any ...
0
votes
1answer
104 views

Automatically add a folder (document set) by code (generating the name also by code, without the user inputting the name)

I want to know if it’s possible to write en Event Receiver in VB for automating the creation of a document set: the user only click “new document set” and then the code generates the document set with ...