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

learn more… | top users | synonyms

0
votes
3answers
1k 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
3answers
1k views

Is it possible to determine if a given URL represents an SPListItem?

I am wondering if there is some sort of way to check a URL to see if it represents a list item before calling SPWeb.GetListItem that I haven't found. I have code that needs to retrieve a list item ...
2
votes
1answer
2k views

Adding SPListItem using SPWeb.ProcessBatchData method

I am looking for adding SPListItem using SPWeb.ProcessBatchData method. Could any one please help me on syntax for adding list item to my custom list.
0
votes
2answers
58 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 ...
1
vote
1answer
2k 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 ...
2
votes
4answers
588 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
276 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
2k 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
614 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
877 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
183 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
187 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
572 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
916 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
667 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
248 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
2k 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
564 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
882 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
268 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
241 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
1k 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 ...
6
votes
2answers
2k 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
743 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
3k 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
78 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
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
601 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
158 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
468 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
569 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
5k 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
106 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
823 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
887 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
4answers
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
924 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
8k 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
2k 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 ...
5
votes
3answers
2k 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
602 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
5k 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
398 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
618 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
311 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) ...