Represents the context of an HTTP request in Microsoft SharePoint Foundation.

learn more… | top users | synonyms

0
votes
0answers
15 views

SPServiceContext is null exception when I try to create result source in farm feature receiver

I created an feature farm scoped. In the eventreceiver of this feature I would like to create a new custom "result source". When I try to deploy I got an exception in VS: Value cannot be null. ...
0
votes
0answers
31 views

How to get Groups RoleAssignments with COM

I'm trying to retrieve Roles Assignments and SPRoleDefinitionBindingCollection from a Group .Probably, I'm using the wrong method to that. The RoleAssignment groupRoleAssignments = ...
1
vote
0answers
22 views

FormContext.FormMode == DISPLAY after calling Edit Item in custom list

In a custom webpart we check on PageLoad the SPContext.Current.FormContext.FormMode to show different additional controls on edit and display mode. If the list is created manually everything works ...
2
votes
1answer
30 views

Missing properties of _spPageContextInfo after page load

I have a script that provision site collections under a specific managed path. In these site collections, I have sub webs with page libraries in which I have several different pages with custom ...
1
vote
1answer
29 views

SPContext.Current.Web.CurrentUser returns wrong user (Broken user database?)

This code snippet is used to Break Role Inheritance on a Document Library and set the current user as the only user who has "Read" priviliges on that Library: SPUser oUser = ...
2
votes
1answer
65 views

Start workflow using App only client context

I use CSOM with client contex which I get from app, the App has following permissions: <AppPermissionRequests AllowAppOnlyPolicy="true"> <AppPermissionRequest ...
0
votes
1answer
97 views

Why is IsCurrentUserMemberOfGroup throwing an exception when run on SPSite.RootWeb?

Running this code in PowerShell (or even in a web context in C#) gives an unexpected behavior: Calling IsCurrentUserMemberOfGroup directly on the RootWeb object gives an exception, and worse: it ...
2
votes
1answer
76 views

Create context for another site collection using NAPA

I am trying to access another site collection using NAPA. I found 2 ways, none of which seem to be working Office 365- Accessing lists refers wrong URL (URL/App name) var context = new ...
0
votes
0answers
109 views

Current user in custom WCF REST service hosted in SharePoint consumed by Workflow 2013

I have a custom WCF REST service hosted in SharePoint. It is configured by MultipleBaseAddressWebServiceHostFactory in .svc file: <%@ ServiceHost Language="C#" Debug="true" ...
0
votes
0answers
21 views

SPContext in SharePoint virtual directory

Reference to this question Adding ASP.NET Web Application to SharePoint Virtual Directory (for SPContext) , I'm facing the same issue; I have created an asp.net website. I've copied the source folder ...
1
vote
0answers
86 views

SPContext.Current is null

I am making a call to a Web service on the initial load of the page through an Angular JS Service. The Web service calls a DLL where I am accessing SPContext.Current. If I am allowing the application ...
0
votes
0answers
482 views

SP2013 - The object is used in the context different from the one associated with the object

I have a function that initializes a custom taxonomy control, as below (not in myControl.js) function initMyControl() { if (something is true) { var context = new ...
1
vote
1answer
389 views

clientContext is always null in Provider Hosted App

I am following this article- http://chakkaradeep.com/index.php/building-apps-for-sharepoint-with-mvc/ to learn building Provider Hosted Apps in SharePoint. I have one developer site collection (I am ...
0
votes
0answers
22 views

Give site directly using client context

I have many sites in my site collection, and I am wanting to get the pages of one site. Is there anyway to give the site that you want the pages for? so like clientcontect.get_site('sitename')
0
votes
1answer
71 views

Get the title and/or link of the parent website in javascript in SP2013

Is it possible somehow in JavaScript to acquire the title and/or link of the parent of my current site? I know that I can create a client context with a specific URL, but is it possible to do this ...
2
votes
1answer
306 views

What is difference between httpcontext and spcontext?

We always use SpContext.Current.Web, but then what is difference between httpcontext and spcontext?
1
vote
1answer
986 views

SharePoint Foundation 2013 - Problem with loading sp.js and sp.runtime.js

I have problem with an order in which I am loading <script type="text/javascript" src="/_layouts/15/sp.js"></script> <script type="text/javascript" ...
5
votes
4answers
2k views

Custom Sign In Page has an SPContext.Current that is always null

Found the Solution The solution was to add a Root Site Collection (as the code was running in a sub-site, without a root site). See This Solution Important Update (based on ...
0
votes
2answers
3k views

What is difference between SPContext.Current.Web.URL and SPContext.Current.Site when using SPSite object?

SPSite spsite1=new SPSite(SPContext.Current.Web.URL); SPSite spsite2=SPContext.Current.Site; What is the difference and when do we decide which one to use? I feel both give us the site collection ...
0
votes
1answer
391 views

Get Context through REST call

I know that in SharePoint 2013 with JavaScript, you can load the current context like so... var context = SP.ClientContext.get_current(); var user = context.get_web().get_currentUser(); ...
0
votes
1answer
779 views

SPWeb.GetList issue on SPContext.Current.Web

When I call SPContext.Current.Site.RootWeb.GetList(someListUrl) I get a System.Runtime.InteropServices.COMException, but when I call the same method from a new SPWeb instance, it runs fine - why? // ...
0
votes
1answer
228 views

Current user doesn't change in webservice after another user signs in

The context: I have this web service hosted in SharePoint. [ServiceContract] public interface IUserService { [WebInvoke(UriTemplate = "/GetCurrentUser", Method = "GET", BodyStyle = ...
1
vote
2answers
90 views

When to call Dispose if passing SPContext.Site to a class library?

I'm just looking for a bit of sanity check on this one! I'm looking at many classes that have SPSite or SPWeb as a constructor for the class. The class is instantiated using SPContext.Site as the ...
0
votes
2answers
2k views

Getting page title in page layout

I am using the following code to get page title of current page in Page Layout but it is not working. <asp:Literal runat="server" ...
5
votes
1answer
3k views

SPContext.Current is NULL for IHttpHandler

I am trying to implement IHttpHandler in SharePoint 2010 and for reference I am using this: http://blogs.msdn.com/b/kaevans/archive/2010/08/04/deploying-an-asp-net-httphandler-to-sharepoint-2010.aspx ...
0
votes
2answers
95 views

Accessing list from variation

I retrieve all the lists in the current web using: foreach (SPList list in SPContext.Current.Web.Lists) {} This works well. The problem is that when a user changes languages, and is routed to the ...
1
vote
3answers
2k views

sharepoint 2010 context menu event handler

i want to hide sharepoint 2010 list/library context menu based on users. i am using below javascript $(document).ready(function(){ $('.ms-MenuUIPopupBody').live('blur', function() { ...
1
vote
1answer
457 views

Web.GetListItem with a non list URL breaks SPContext

We have a bit of a weird issue and i was wondering if anyone had any insight on why the issue was occurring. We have a page deployed into the SharePoint root which has a custom webpart which would ...
2
votes
1answer
678 views

Calling SP.ClientContext in a loop Javascript

I'm looping through a number of sites to run a query that checks whether new content has been added to document libraries in that site in the previous three days. However, I'm having problems. When I ...
2
votes
1answer
3k views

Accessing a list from app web on host site generates access denied

I am trying to get title of a list which is located on Host Site from an SharePoint hosted app by using csom (javascript). I have added permission on Manifest file and chose the list but still getting ...
2
votes
3answers
3k views

Is there an alternative to SPContext.Current.Web.CurrentUser?

I have found that SPContext.Current.Web.CurrentUser is really unreliable. One out of ten requests that object comes back as null. Is there an alternative to SPContext.Current.Web.CurrentUser? Has ...
2
votes
2answers
701 views

How to determine item ContentType in FormControl (FieldIterator for instance)?

I've implemented my ListFieldIterator to change the way field controls rendered. I'd like to change the behaviour of form depending on the item content type, but any attempts to determine ...
1
vote
3answers
282 views

SPWeb = this.Web always points to Central Administration?

I'm learning SharePoint 2010 and facing a strange problem : I implement a custom action to add a ribbon button under Documents tab, this button has a command to open a modal dialog in my site which ...
2
votes
1answer
263 views

Will using a `SPList` object derived from a disposed `.OpenWeb()` cause errors?

Will using a SPList object derived from a disposed .OpenWeb() cause errors? SPList list = null; using (SPWeb web = SPContext.Current.Site.OpenWeb("/myweb")){ list = web.Lists["Awesome Name"]; } ...
0
votes
1answer
278 views

Setting a Lookupfield for current Item in List

my use-case: I'm trying to implement an event-management system to sharepoint using visual web part(s). I have two custom lists, one is called "events". Let's say it has a column "Title" which shows ...
1
vote
2answers
1k views

Get SPWeb from SPContext in WCF hosted on SharePoint

I have created and deployed a WCF service in SharePoint and I am sending requests using JQuery. Every thing is working fine except for sub sites. Lets say I have these two service URLs: - ...
0
votes
1answer
191 views

SPContext of Application Page in Modal Dialog

I'm trying to get a specific group out of the group collection of the current SPContext. The current SPContext is hosted in a Application Page, which is displayed in a Modal Dialog. The web instance ...
0
votes
1answer
294 views

Grab list of site collections from SPFarm object

I have a Farm level feature that returns null when I try to access SPContect.Current.Site. Is another way to grab a list of site collections? I have access to SPFarm.Local
0
votes
1answer
559 views

Adding ASP.NET Web Application to SharePoint Virtual Directory (for SPContext)

I'm inheriting an ASP.NET application that is hosted within the IIS SharePoint web site. From IIS, right click the Web Site, and click 'Add Application' is the method used here. In our dev server, ...
1
vote
2answers
758 views

SPContext.Current is sometimes null in code behind of InfoPath

On occasion I find that SPContext.Current returns null in the code behind of my InfoPath forms. This is occuring while I have the form open in a SharePoint 2010 site collection. I can't figure why ...
1
vote
1answer
583 views

ClientContext error while embedding a Silverlight control on ASP page

I build a visual web part in asp.net and I'm trying to embed a xap over it so that users who don't have Silverlight installed would see the asp content: <object id="SilverlightPlugin1" ...
0
votes
0answers
26 views

SPContext is null on Feature Activation [duplicate]

Possible Duplicate: Error : Object reference not set to an instance of an object on feature deployment I am writing a feature receiver. Here is my code sample on feature_activated code. ...
0
votes
1answer
778 views

Proper use of SPWeb from SPContext for pulling lists

So, after about two hours on the subject I am thoroughly confused. There are viewpoints all over the place on how, when, and why to use Dispose() on SPWeb objects as they relate to SPContext. Can ...
5
votes
6answers
982 views

SharePoint 2007 : How to sign out user?

I've an application build on SharePoint 2007 platform, the problem is in Mozilla FireFox, the sign out button does not successfully sign out the current login user, I believe SharePoint 2007 is not ...
0
votes
2answers
966 views

Using the FieldRendingControl for a given content type

I'm creating a webpart that acts like a new form. Based on a view I'm getting on fields and rendering them in my webpart using spfield.FieldRenderingControl. My columns are site columns, at this ...
5
votes
2answers
936 views

Why does the FileUpload control get bound to the current list item in a custom list EditForm?

I've written a custom edit form for a list which means I lose certain out of the box capabilities such as Attachments as it was part of the out of the box form. The way I have implemented the form is ...
2
votes
2answers
1k views

Life cycle of SPContext.ListItem

I have created a messaging system (basically a simple announcement list with a recipient and a IsRead flag). This have been done by creating the classics web fields, content type, list schema and ...
0
votes
2answers
3k views

Error using SPContext.Current.Web.AllUsers in Visual Studio workflow

I have the following code running in a Visual Studio workflow. I am trying to specify the user who is adding list items in the code because I guess the system account (default for VS) will not allow ...
0
votes
1answer
368 views

get context login info

I see all kinds of code to get current SharePoint 2010 logged in user. (I guess current context user from the browser client). What is the best code? (not currently logged into machine user)
5
votes
4answers
7k views

Get current web url in a SPRibbon Custom Action Command

I've a SPRibbon custom action with the purpose of open an custom app page in a modal dialog, but I'm getting troubles for getting the current web URL, as well, set a reference for a .js with the right ...