0
votes
1answer
43 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
0answers
42 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
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 ...
2
votes
3answers
2k 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://mydomain.com/: item.ParentList.ParentWeb.Url.TrimEnd('/') //"http://mydomain.com" + "/" ...
3
votes
2answers
80 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 ...
1
vote
1answer
315 views

Transfer Multiple people picker column's value from one site to another

I have a column of multiple people picker called Likes in 2007 sharepoint site which stores n number of people. Now i want to programmatically transfer it's content to sharepoint 2010 site. Problem ...
2
votes
1answer
400 views

Programmatically get the central administration site SPWeb using server object model

Like in the title - is there a method of getting it without supplying the URL?
0
votes
1answer
139 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
137 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
3answers
68 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 ...
4
votes
3answers
517 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 ...
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
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 ...
0
votes
0answers
393 views

Cannot remove file <x>. Error Code: 16388

I've written a tool top copy/paste/delete files accross site collections and then remove the original version from the recycle bin. The method to copy the files is: public bool ...
1
vote
1answer
72 views

Checking SharePoint Uptime Remotely

I was wondering how people have gone about programatically checking if SharePoint is still available? I use the following now to check it, but it relies on the SharePoint object model and must run on ...
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) { ...
2
votes
1answer
286 views

Is there a way to only clear a specific item from the recycle bin?

I know I can empty the recycle bin for a site collection with the following: public static bool EmptyRecycleBin(string siteCollection) { try { using ...
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> /// ...
2
votes
1answer
101 views

Deleting a SharePoint User Profile remotely

Can anyone tell me how to delete a SharePoint user profile remotely? I don't see a way to do this using SharePoint Web Services or User Profile Services. The following code works fine when run on ...
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 = ...
2
votes
1answer
164 views

Server side equivalent of this Client Object Model code?

I have the following javascript: SP.ListOperation.Selection.getSelectedItems(); And I'm wondering if there is a Server Side Object Model equivalent to this that I could use in Page Load? The ...
2
votes
1answer
93 views

Possible to use the object model to push content across two different web applications?

I've been able to use the object model to move list items between sites in the same site collection, but I'm wondering if I can use it to move list items between two different web applications on ...
1
vote
1answer
164 views

What are “unsafe updates” for list items?

In the SharePoint 2010 server-side object model the SPWeb Class has a property "AllowUnsafeUpdates". What are unsafe updates in connection to list item changes? How are they to be delt with in code? ...
0
votes
1answer
102 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 ...
6
votes
5answers
9k views

In which situation use SPSecurity.RunWithElevatedPrivileges with superusertoken?

i have given permission only read only to Users Group.so there are not access to see listitem or any list. i have create application page with SPGridview with bind listitem. this page access by this ...
1
vote
1answer
380 views

Dispose issue when working with content types

I am seeing an issue with un-disposed SPRequest objects in the ULS logs when i work with content types in the object model. My code is as follows (in previous methods run as part of this request, the ...
3
votes
2answers
1k 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 ...
1
vote
2answers
902 views

Programmatically reading static links in the navigation

I'm having a SharePoint site where I disabled the "show pages" option in the navigation, and created my navigation using the add static heading/link option. My problem now is that I tried to ...
2
votes
3answers
260 views

Deny user access from SharePoint Native but allow it from custom application

How can i restrict a user from entering SharePoint - unless he is using my custom application? For example, a user tries to open http://Mysite , he gets an access denied error. But as the same time, ...
4
votes
2answers
309 views

Efficiently determine if a List is using item level security

How can you efficiently determine if any of the items in a List don't inherit their security from the List? You could use SPListItem.HasUniqueRoleAssignments but this would require iterating through ...
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
1answer
2k views

GridView control - paging with linq. Where is objectDataSource?

I have visual web part with custom logic which retrieves me strongly typed list (not SPList -> .NET list object) which than I bind to gridview which has paging enabled. That works fine. Problem is: ...
4
votes
1answer
2k 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 ...
26
votes
2answers
6k views

When to use OpenWeb() vs RootWeb

I am a little confused on the pro's and con's of each. When is it good to use OpenWeb() vs RootWeb, especially in the context of a using statement.
1
vote
2answers
330 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 ...
4
votes
1answer
2k views

How to find the Author Name using SP Client Context in SharePoint 2010?

I am trying to find the Author Name(created by) for a given Item Id using the SP Client context in SharePoint 2010. Below the code snippet var ctx = new SP.ClientContext.get_current(); ...
2
votes
4answers
309 views

Document Library throws NullReferceException everytime I try to grab an item

This code is from a sequential workflow. I am trying to grab the most recent item in a document library. I check to make sure there are more than zero items in the library, then I try to grab the most ...
0
votes
1answer
514 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 ...
3
votes
1answer
667 views

SPLongOperation never ends

I have an SPLongOperation that occasionally fails to redirect the user to a new page when the operation completes. I'm not sure what circumstances cause the problem, since I don't yet have a reliable ...
5
votes
1answer
3k 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. ...
1
vote
5answers
1k views

for vs foreach when iterating over SPWebCollection

I was just wondering which of the two methods below is more popular, when it comes to iterating over a collection of SPWeb objects. for (int i = 0; i < SPContext.Current.Site.AllWebs.Count; i++) { ...