SPWeb is a single website in SharePoint residing in a Site Collection (SPSite).

learn more… | top users | synonyms

1
vote
1answer
259 views

Get all webs with certain property value

If I have a certain number of webs within my site collection, and those web have set some property, eg. web.Properties["foo"] = "bar". I'd like to get list of all the webs which have property foo set ...
1
vote
2answers
1k views

Get file from any library in the web tree

Is it possible to use some built in SharePoint API to open a file no matter which web and library it's in? Example: Given the file: /subsiteA/PublishingImages/myimage.jpg I want to open it and get ...
1
vote
1answer
527 views

SPWeb is undefined

I am a newbie in sharepoint and only for 1 month. I am using sharepoint 2007,.aspx. and doing for an email form with some validation, after user pass the validation the email send. But I'm getting the ...
3
votes
3answers
1k views

How to create Site (SPWeb) on Sharepoint Online

I have a problem creating Sites on Sharepoint Online. The code that works on-premise do not work on Sharepoint Online. I do not want to bother you with the code, i just want a clean start. So my ...
2
votes
3answers
724 views

Error using current SPWeb from HttpModule

Is it allowed to access SPWeb and specifically SPWeb.ID from PreRequestHandlerExecute ? Writing an HttpModule [SharePoint2010] and trying to access current web ID using this line of code : private ...
1
vote
2answers
1k views

Error using SPRequest when the SPWeb is already disposed

Is this correct way of using the SPSite and SPWeb and the SPList. private SPList list; pulic void getList() { using (SPSite site = SPContext.Current.Web.Site.WebApplication.Sites[0]) { using ...
3
votes
1answer
174 views

Disposing of SPWeb object query

I'm trying to understanding the object clean up process. using (SPSite siteCollection = new SPSite(siteUrl)) { SPWeb site = siteCollection.RootWeb; foreach (SPList list in site.Lists) { if ...
0
votes
1answer
180 views

Sharepoint 2007 WarmUp Script (Memory Leak Possibly)

I was wondering if there is any way I can get a SPsiteCollection object using a URL + if I can dispose it using "using" keyword as well. I want to go through all the SPWebAPplications in a Local ...
0
votes
2answers
500 views

EnsureUser not working in Job

Background: sharepoint 2010 custom membership provider custom job to create users Job is deployed by code and executed first time from some WinForms exe, executed by local Administrator. Users are ...
7
votes
4answers
807 views

What are the dangers of using a static class that contains your SPWeb object?

When creating my SharePoint 2010 solutions, I often create a static class that contains helper methods and lists, documents, list items, etc that I use frequently. What would the dangers of putting my ...
0
votes
1answer
582 views

programmatically get IDs of list from urls

Is it possible to retrieve the ID of a list or library with a url? For example, http://MyPortal/MySubsite/MyDocuments/Forms/AllItems.aspx If so, please provide me with some sample code. Many ...
0
votes
2answers
228 views

SPWeb object is empty

I create a SPWeb object with a relative url to my SPSite using (SPWeb web = SPContext.Current.Site.OpenWeb(url)) { SPList centralManagementList = web.Site.RootWeb.Lists["mylist"]; string id = ...
2
votes
3answers
1k views

List of all users having access to at least one site in the site collection

I want to retrieve all the users who are having any access to at least one site in a site collection. I tried using 'SPWeb.SiteUsers' and it gave me almost what i wanted. The only exception was - it ...
0
votes
2answers
466 views

Webservice - Create SPWeb

I want to create a script with PowerShell and Webservices for a site collection admin. My plan is that site collection admin can use the script to create new SPWebs. I donĀ“t found any good examples ...
4
votes
1answer
746 views

Is accessing AllProperties efficient?

I'm currently storing a few values in the SPWeb.AllProperties hashtable. But I'm thinking of adding even more data into it. Before I start using it more and more though, I wondered if using ...
0
votes
1answer
249 views

Effectively Querying Subsite RootFolder.Properties

I'm storing some data in the RootFolder.Properties for a bunch of subsites, sub-subsites and sub-sub-subsites. On the parent site(s), I want to roll up that data, security trimmed for the user. (All ...
1
vote
1answer
199 views

Error while downloading Lists in a spweb

Here is the code private void downloadList(SPObjectData objectData) { using (SPWeb currentWeb = objectData.Web) { foreach (SPList list in currentWeb.Lists) ...
5
votes
2answers
976 views

Will passing SPWeb as by value parameter cause a memory leak?

I have an issue in my SharePoint environment and I suspect that this code causes a memory leak. I'm passing a SPWeb object as a value parameter. Will the SPWeb object instance get disposed correctly ...
5
votes
2answers
1k views

Do I need to reset SPWeb.AllowUnsafeUpdates after use?

Do I need to reset the SPWeb.AllowUnsafeUpdates property after use? Seems not, but all over the web there is code like: bool allowUnsafeOrig = web.AllowUnsafeUpdates; web.AllowUnsafeUpdates = true; ...
2
votes
2answers
616 views

What tool to use to check memory leaks in SharePoint

Currently I encounter memory leaks in my SharePoint 2007 application. What is the best tool to identify is there any un-dispose objects in the codes? Example like DataTable, SPWeb, or SPList.
3
votes
4answers
2k views

Get SPWeb by ID without Site Collection?

I have a list of SPWeb IDs and would like to open the associated SPWeb objects. However, I do not know in which Site Collection they are (I DO know that they are in the current Web Application ...
5
votes
1answer
72 views

How can i get name of the site definition configuration or site template from SPWeb?

I know that SPWeb have "WebTemplate" property and it always gives me string like "STS" or "MPS", but what I need is something like "STS#1". There is also "WebTemplateId" property, it gives WebTemplate ...
6
votes
3answers
3k views

Detected use of SPRequest for previously closed SPWeb object within workflow

I have a visual studio sequential workflow. In that workflow, I have a string property called AllowDisposition. When the workflow starts, I populate that value by doing workflowProperties.Item["FIELD ...
7
votes
3answers
541 views

Should SPWeb objects be passed to other methods or re-instantiated?

Should I pass my SPWeb object to a method or recreate it in that method?
0
votes
2answers
152 views

SP2010 Update Site Title and Description - Security problem

I've created a custom application page to update the Title and Description of a site. The page is generating an access denied and the following error message in the log file: Unknown SPRequest ...
1
vote
1answer
375 views

Programmatically deleting user from All People

i am able to remove the user from site collection using in this way:- SPWeb.SiteUsers.Remove("providername:" + this.txtOldName.Text); but found the same user existing in All People how to remove ...
1
vote
1answer
482 views

Create a safe url (remove diacritics and spaces)

I want to create a site with a title provided from a user and use the title as the site url. However I want to remove spaces and diacritics. I replace spaces with a hyphen, and I run ...
5
votes
3answers
4k views

How to run with elevated privileges in application page?

I want to get a list item that the current user does not have access to but I need to get it in code. When I use SPSecurity.RunWithElevatedPrivileges that does not work. It's because I'm using the ...
1
vote
1answer
103 views

Disable Web-scoped features on Web deletion

I have a SPWeb ( http://example.com/site ), created used a custom web template, with several features activated on its scope. When I delete the SPWeb it would be desirable that all the features ...
1
vote
1answer
764 views

SPWeb.GetListItem returns null in custom workflow activity

I created an custom workflow activity with the following code: namespace Custom.SharePoint { public class CustomActivity : Activity { #region Fields public static readonly ...
9
votes
4answers
761 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 ...
2
votes
3answers
2k views

SharePoint 2010 - Add WebPart to a Web with PowerShell

I want to add a webpart to a great number of existing pages. Is there any PowerShell command to add a webpart to a webpart page?
2
votes
1answer
862 views

Disposing of objects in an Event Receiver

I have an ItemUpdated event receiver running on a library. Some pretty basic logic. Here's the gist of what I'm doing: SPWeb web = properties.Web; SPContentTypeId ParentCT_Id = ...
5
votes
4answers
7k views

How can I get a reference to a specifc SPWeb object in a custom timer job?

I have a custom timer job that imports data from an external source into a specific list on a specific Web in my SharePoint 2010 installation. That is the job is only relevant to one list on one web. ...
3
votes
4answers
1k views

How to properly use the Using Statement with SharePoint Objects

What is best practice with the Using statement when working with SharePoint Objects. When and how should you use the Using statement, so objects used are disposed, etc?
2
votes
1answer
2k views

SPWeb.CurrentUser gives wrong result when called from HttpModule

I am trying to get the current logged-in SharePoint username through SPWeb.CurrentUser. This usually provides the results I am expecting, except in one instance. I am logged into my development ...
4
votes
3answers
1k views

Should I dispose SPWeb or SPList?

I am doing a whole bunch of things with one SPWeb and many SPLists. If I just dispose web in the finally section would that dispose all of SPLists that I instantiated? (btw, I understand the concept ...
9
votes
1answer
539 views

Is it necessary to call SPWeb.Update() after setting AllowUnsafeUpdates?

Amidst working on resolving this issue, there's something I was curious about, and something that I've been very inconsistent about in my code. If you enable SPWeb.AllowUnsafeUpdates = true, do you ...
18
votes
3answers
4k views

Find Document by GUID

I'm missing something that must be so simple that it's not even worth asking... but I have an object ID (GUID)... How do I figure out the document it points to? For example I have a GUID of ...
1
vote
1answer
1k views

SPImmediateAlertsJobDefinition errors in Event Log

I am sporadically getting errors in my Event Log for SPImmediateAlertsJobDefinition with the ID 6893, I've seen some of the posts out there pointing towards issues with the SharePoint assembly files. ...
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 ...
0
votes
2answers
395 views

Battling to get SPWeb, Sharepoint 2010 Object Model.

I have the following URL to a subsite : http://myServerName/subSiteName I know the URL to the subsite upfront. So far I'm trying this, but it won't work. using (SPSite spSite = new ...
0
votes
1answer
537 views

SPWeb.RegionalSettings.TimeZones

Apparently each SPWeb can have it's own list of TimeZones (assuming that is why there is a TimeZones property on each SPWeb's RegionalSettings). Why could/would a web/site within a site ...
1
vote
1answer
292 views

ParentWebId: Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007

Following the guidance below (1) to ensure that the stack trace of the allocation of the SPRequest object is preserved in memory and added to the ULS logs, I'm seeing a steady stream of 8l1n (High) ...
2
votes
2answers
430 views

SPWeb.ParserEnabled

What does the SPWeb.ParserEnabled property do? I had a problem for some document which are not able to update metadata.If i use ParserEnabled = false.it is working fine for me. if i use ...
1
vote
3answers
1k views

Storing custom properties for a SharePoint Site

Let's say you are building a Project Management solution where each Project equals one site (SPWeb object). Each project has it's properties like: Project Manager, Budget, Customer, Description, ...
1
vote
1answer
127 views

How to properly dispose of SP objects although not assigned?

If I assign SPContext.Current.Site.OpenWeb().Title to a string, do I need to dispose of it (if possible)? string title = SPContext.Current.Site.OpenWeb().Title; I'm still a little fuzzy on when to ...
4
votes
2answers
3k views

How to access a file in the current url or _layouts folder?

My code behind code from the aspx webpage uses a transform.xsl to do some custom xslt transformation. Scenario 1: Try to get the file from the _layouts folder. SPWeb web = SPContext.Current.Web; ...
1
vote
1answer
607 views

Memory Leak - Disposing SPSite and SPWeb?

So I read through another post here http://www.sharepointoverflow.com/questions/1047/disposal-of-spwebs-created-using-spsite-openweb. Currently I only dispose of the SPSite object, and from my ...
4
votes
2answers
6k views

Using SPContext.Current to get public URL of the current zone

I have a single content Web application in the Default zone of my MOSS 2007 farm, which I then extended to the Extranet zone. The default zone web application uses Windows authentication and standard ...