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

learn more… | top users | synonyms

0
votes
2answers
859 views

Get all SPLists for a site collection

I feel like I'm very close on this one. I know how to get the root site collection from this: How can I get the root site collection from SPContext.Current? I've been messing around with ...
0
votes
2answers
103 views

How to find if a SPWeb is search site?

I want to check SPWeb reference if it is a search site. How can i do this by code. Thank you
0
votes
1answer
526 views

“Detected use of SPRequest for previously closed SPWeb object” within Event receiver but no error when run in test harness

I have a very strange issue which I cannot explain. We have and event receiver and within this we instantiate our own class that does all the work we need it to do. As part of this we pass in an SPWEB ...
0
votes
1answer
878 views

Get all document libraries from a site URL

I'm trying to build a WPF application in which the user specifies the URL in a textbox and after clicking "Connect" the app will fill a Combobox with a list of SharePoint Document Libraries. I'm ...
0
votes
1answer
297 views

Dispose SPWeb object in recursive function

I have updated my code as per suggestions from suggestions on my earlier question , I still see the error message for one of my recursive function. Below is the code snippet to recursively loop ...
0
votes
3answers
697 views

SPSite and SPWeb object dispose inside foreach loop

I have a code that loops through all the Sites and Webs in a web application. My code uses for..each loop to navigate through each site and web object. I was wondering if we are required to dispose ...
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 ...
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 ...
0
votes
2answers
57 views

How do I figure out if I have permissions to use site.openWebs without changing code?

I have been newly assigned to a client and I am trying to run an existing console app to get some information about files within their sharepoint instance. The code goes something like this: //Enter ...
2
votes
3answers
718 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
1answer
1k views

c# iterating SPWeb.Navigation.GlobalNodes

When I try to iterate through the GlobalNodes collection using c# it is always empty unless I the site and manipulate the navigation settings manually. Can anyone tell me why this is and/or give an ...
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 ...
2
votes
4answers
518 views

What are the dangers of disposing of SPWeb when it's automatically disposed of?

In some cases such as: using (SPSite site = new SPSite(@"http://sitecollection/")) { SPWeb web = site.RootWeb; } you don't need to dispose of the SPWeb object because it is disposed of ...
1
vote
1answer
258 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
526 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 ...
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 ...
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 ...
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 ...
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?
7
votes
4answers
805 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
227 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 = ...
0
votes
2answers
463 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
744 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 ...
1
vote
1answer
196 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
974 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
1answer
1k views

What is the SPWeb.Name property for?

I'm wondering what use does the SPWeb.Name property have. Is it displayed anywhere?
6
votes
3answers
3k views

Disposal of SPWebs retrieved from SPContext.Current.Site.AllWebs

As there was a minor disagreement on whether SPWebs retrieved from SPContext.Current.Site.AllWebs should be disposed, I thought it would be appropriate to post a new question and discuss it here. I ...
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 ...
7
votes
3answers
538 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?
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
481 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 ...
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
763 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
757 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
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 = ...
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) ...
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
538 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 ...
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 ...