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

learn more… | top users | synonyms

0
votes
2answers
1k 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
1k 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
4k 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
401 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
8k 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
949 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 disabled....
1
vote
0answers
660 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
2k 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
399 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.
29
votes
1answer
26k 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
3k 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
1k 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 ...
0
votes
2answers
5k views

What is the most effecient way to get the current server name?

I need to determine the 'main' server name based on the My Site server name in a control. This control needs to work in multiple environments with a different set of servers in each. Example: My ...
0
votes
3answers
772 views

SPContext returns wrong user account [closed]

I'm creating a web part on a non local server and I need to get the current user logged in to SharePoint. I'm using the following code to get the username. string currentUser = SPContext.Current.Web....
11
votes
3answers
2k views

Should I dispose these SPSite and SPWeb objects?

Is it necessary to dispose the site and web objects in the following code? If so, how do I do this? Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim site ...