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

learn more… | top users | synonyms

0
votes
0answers
11 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
51 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
60 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 ...
0
votes
1answer
54 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
18 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
32 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 ...
1
vote
1answer
108 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
342 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" ...
0
votes
0answers
27 views

Can I use clean URLs with a valid SPContext.Current object?

I know I can use clean URLs with SP 2010 but my problem is the SPContext is always wrong. It sets SPContext.Current but always to the RootWeb with no ListItems or even List information. I know if my ...
4
votes
4answers
876 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
1k 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
269 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
401 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
151 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
77 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
1k 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" ...
4
votes
1answer
2k 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
76 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
298 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
571 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 ...
1
vote
1answer
2k 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 ...
1
vote
3answers
2k 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
536 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
255 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
221 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
244 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
1answer
979 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
174 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
252 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
481 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
668 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
486 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
638 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
869 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
852 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
822 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
885 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
351 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 ...
0
votes
0answers
720 views

Problem with ASMX and SPContext.Current equals to null

I'm deploying my application to an Sharepoint Foundation Farm... In my application there is a web service (tt2sp.asmx) installed in the _vti_bin directory. On my site the anonymous access is ...
1
vote
0answers
504 views

Fake SPContext as a particular user

I am using this method of faking an SPContext: http://solutionizing.net/2009/02/16/faking-spcontext/ public static SPContext FakeSPContext(SPWeb contextWeb) { // Ensure HttpContext.Current if ...
2
votes
3answers
1k views

How to get full home page address of a site collection?

When I use SPContext.Current.Site.Url it returns "http://servername" I need the full homepage URL which is "http://servername/SitePages/Home.aspx" Does anyone know how to get this programmatically?
3
votes
2answers
2k views

SPContext.Current vs SPContext.GetContext

To get current SP objects (SPWeb, SPSite, SPList etc), I generally use SPContext.Current. In some situations, SPContext.GetContext is preferred because SPContext.Current have many objects null ...
7
votes
4answers
292 views

How do I get machine name off of the SPContext

Simple question... how do I get the machine name off of the SPContext object.
23
votes
1answer
15k views

Using SPContext.Current or using static URL

There are multiple ways to work in the SP object model. The starting point for instantiating objects looks different when you look at different developers. Many times I see people doing this: SPList ...
3
votes
1answer
2k views

Is SPContext.Current Supposed to Be null in Custom WCF Service?

Here is the scenario: Custom WCF Service deployed in SharePoint 2010 Site is using Claims Based authentication (FBA, NTLM) .svc is deployed to ISAPI in the hive Service is configured using custom ...
9
votes
4answers
929 views

Disposing and Closing SPWeb objects

I have used something like using (SPWeb web = SPControl.GetContextWeb(Context)) but while deploying the project it shows an error. While trying to figure out the cause I came across an msdn ...