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

learn more… | top users | synonyms

2
votes
1answer
27 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
0answers
19 views

How to get the SP context in an MVC Post action in a sharepoint provider app

I have the following asp.net mvc view in my provider hosted app @{ Layout = "~/Views/Shared/_LayoutPage2.cshtml"; } @using (Html.BeginForm("Submit", "Customize", FormMethod.Post)) { <div ...
0
votes
1answer
89 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 ...
1
vote
1answer
49 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
79 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
77 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
286 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
275 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
21 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
56 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
237 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
822 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" ...
4
votes
4answers
1k 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
348 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
708 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
195 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
83 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
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
90 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
405 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
627 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
645 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
273 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
248 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
266 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
187 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
284 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
522 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
740 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
549 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
737 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
952 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
927 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
885 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
360 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
793 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
538 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 ...