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

learn more… | top users | synonyms

1
vote
2answers
4k views

Getting SPWeb in feature receiver

While testing my solution I receive an error on Feature activation: Detected use of SPRequest for previously closed SPWeb object. Please close SPWeb objects when you are done with all objects ...
1
vote
2answers
279 views

Changing language programmatically

I am having some problems in changing the language in SharePoint programmatically. I have two language packs installed on my server (Norwegian and English). If I change the language manually through ...
1
vote
1answer
22 views

Get server-relative URL from SP.Web

I'm trying to retrieve a relative url from a SP.Web I get my sp.web from a SP.list with SPWeb test = listNL.ParentWeb; When I try to get the url I got an exception: test.ServerRelativeUrl' ...
2
votes
1answer
1k 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
3answers
49 views

Check if URL is a valid SPWeb in an SPSite

I have a URL and I want to check if it exists as sub-site for a given URL. I have a URL = www.go.com I want to check if = www.go.com has URL = www.go.com/abx or not I have +1000 sub webs, do I ...
3
votes
2answers
184 views

Get SPWeb at all the levels

I have a root site with sites at different levels(depth is unknown). How can I find all the SPWeb objects iterating till the deepest level. will the below code give me desired result ...
0
votes
1answer
67 views

Can't get granular file .bak or .cmp to restore. “Unable to read cabinet info”

I made a granular backup of my site collection into .bak. and now I'm trying to import said file by using Import-SPWeb -identity http:testserver/sites/test -path \\sharedstore\backup.bak I have the ...
0
votes
1answer
56 views

Uncommitted changes on SPWeb object

In my simple Powershell script, I keep getting an error "Exception calling "ResetRoleInheritance" : There are uncommitted changes on the SPWEb Object, call SPWeb.Update() to commit the cahnges before ...
0
votes
1answer
70 views

Can't delete SPWeb from PowerShell or C# Object Model

I have a very strange situation - two sub webs were created through some code but it errored out part way through the process and now I am left two webs I can't seem to delete. The strange part is ...
2
votes
2answers
692 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.
0
votes
3answers
78 views

What is Site, Web, Site Template and Web Template in SharePoint?

Can anyone please tell me what the difference is between Site and Web in SharePoint. Also what is Site Template and Web Template?
1
vote
1answer
559 views

Check if SPUser has access to an SPWeb object without causing an Access Denied redirect

As part of a Workflow Association Form code-behind we need to access information on different sites (in the same site collection). It is possible that the user trying to configure a workflow does not ...
2
votes
1answer
116 views

What is the effect of setting SPWeb.AssociatedOwner/Member/VisitorGroup

I would like to know the effect of setting/changing the value of the SPWeb properties AssociatedOwnerGroup, AssociatedMemberGroup, and AssociatedVisitorGroup - the only effect I can glean is that it ...
1
vote
2answers
91 views

SPWeb dispose after crashing powershell ISE [duplicate]

I built a powershell script that connects to sharepoint and adds items to a list. This script caused the PowerScript ISE editor to stop responding and crash before disposing. The SP server logs ...
0
votes
1answer
185 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
0answers
37 views

Displaying Sharepoint objects in PropertyGrid - low performance

At first i didn't know where I should ask this question since it's about Windows Forms and SharePoint but after a bit of searching I decided this is a good place. I would like to know if there's a ...
0
votes
2answers
36 views

Is it okay to keep an SPWeb object alive longer than its httprequest?

Scenario (note this is hand written dummy code - might not work :) public class MySuperClass { private static Dictionary<int, MySuperClass> _instances = new Dictionary<int, ...
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 ...
1
vote
2answers
124 views

AssociatedGroups collection of SPWeb?

I'm having a hard time understanding the purpose of adding an SPGroup to the AssociatedGroups collection (or its respective property bag item) of a site other than the group(s) appearing in the quick ...
1
vote
1answer
14 views

Printing out contents

how can I print out $user["EMail"] from below code snippet cls $web =Get-SPWeb http://wer.com/sites/wooly/ $list=$web.Lists["User Information List"] $user =$list.GetItemById(##) ...
0
votes
0answers
172 views

Error during Import-SPWeb

I am trying to exporting from my developing machine which has a backup of the content database, and importing it back in the production farm. Running: Export-SPWeb -identity http://mysite -Path ...
4
votes
1answer
2k views

Is it possible to copy SP Web from 2010 to 2013?

All I am trying to do is copy a SharePoint Web (i.e: http://sp2010/hr) to (i.e: http://sp2013/hr). I was able to export using: Export-SPWeb http://sp2010/hr –Path "hrexport.cmp" But when I try to ...
0
votes
1answer
130 views

SPWeb permissions inside RunWithElevatedPrivileges

Please consider following scenario: public override void ItemUpdated(SPItemEventProperties properties) { SPSecurity.RunWithElevatedPrivileges(delegate() { SPWeb web1 = properties.Web; ...
3
votes
1answer
2k views

System.InvalidOperationException: Operation is not valid due to the current state of the object

This error happens on every page of the site. I click on link to open page like http://myportal.com/Lists/List1/ SharePoint open it and in url add smth like AllItems.aspx, so it url looks like ...
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
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 ...
4
votes
3answers
105 views

best way to store property of a site

I have a site called Exhibitions that contains many many subsites each of which is an individual exhibition (with pages, images etc). I would like to attach to each of these subsites a property which ...
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
3answers
108 views

How to get all SPWebs using visual studio?

I want to get all webs including it's subwebs. Eg. Site web1 subweb1 subweb2 web2 How to achieve ?
1
vote
2answers
121 views

Getting the logged in user given the SPWeb, regardless of elevated priveleges

I have a requirement to be able to always get the logged in user. The object the calling process is going to pass is the spweb. As this is legacy code, I cannot change what the calling processes ...
0
votes
0answers
36 views

SPWeb approvers. Different users for each SPWeb in a site collection

I have created a custom site collection and in this site collection are multiple SPWeb news sites. The news SPWebs are moderated by different groups of users. I want to create a group for each news ...
0
votes
2answers
98 views

How to properly dispose of sp 2007 object in powershell?

First and foremost I've done A LOT of googling and even went past the first page or 2 :) so feel free to direct me to the proper post if necessary. I am trying to loop through a bunch of webs and ...
0
votes
4answers
3k views

Detected use of SPRequest for previously closed SPWeb object after SPQuery

this code run yesterday very well and today I've been trying to solve this error for hour now : Please close SPWeb objects when you are done with all objects obtained from them, but not before I ...
0
votes
1answer
780 views

Get N Number of subwebs for specified web

How to get All Subwebs upto N Levels for Specified Web. eg. My Site url is... "http://server/web1" I need all subwebs upto N Levels for web1.. below line get all subwebs upto N Levels of ...
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. ...
0
votes
2answers
157 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 ...
0
votes
0answers
72 views

Any ideas why the Inherit is not available on a SPWeb?

Any ideas why the Inherit is not available on a SPWeb?
1
vote
1answer
251 views

joining absolute and relative URLs of sharepoint in <a href> anchor tag

I want to join absolute and relative URL parts of a sharepoint site in <a href="http://somesite"> tag. i already have this: strng.Format(@"<a ...
1
vote
2answers
351 views

Add script reference to all pages in a site collection when a feature is activated

I'd like to have a feature which adds a script reference to all pages in a site collection when activated. This seems like a scenario where I should just modify the master page, but for it to affect ...
2
votes
2answers
500 views

SPSite.RootWeb.AllProperties is null Claims Authentication

I just created a new WebApplication & Site Collection in sharepoint. Note : WebApplication uses Claims Authentication mode, Custom Trusted Identity Provider for my application. In powershell ...
1
vote
3answers
85 views

Is using the Using statement to close unknown and possibly Current webs, bad practice?

Until today I had been using the Using statement to open and dispose of webs. The variable relative_web_url is defined by a user input in the custom web part editor. using (SPWeb web = ...
0
votes
3answers
976 views

Getting SPWeb Object in two ways

I want to access SPWeb object in feature under its FeatureActivated method. There are two ways to do this: Public Override void FeatureActivated(SPFeatureReceiverProperties properties) { //Method 1 ...
1
vote
1answer
512 views

WebProvisioned Event Is Not Firing When Creating SPWebs Programmatically

I have a WebProvisioned event receiver and i do some work in this event receiver. When i create new webs from a console application programmatically, it seems the event receiver does not fire? Is this ...
0
votes
2answers
323 views

How check if a site (not site collection) has sub sites in it? [Object Model]

I am trying to figure out a way to check if a Site inside a Site Collection has sub sites in it. To get sites inside a site collection, we can use the below code. foreach (SPWeb siteobject in ...
0
votes
1answer
202 views

Creating New-SPWeb from PowerShell & WebProvisioned Event Receiver?

I have a WebProvisioned event receiver and i do some work in this event receiver. When i create new webs from powershell, it seems the event receiver does not fire? Is this an expected situation? How ...
1
vote
0answers
268 views

_spBodyOnLoadFunctionNames.push Not working in firefox

I tried this in firefox i dont know why its not working but it working in other browsers function loadmonth() { alert('called'); } _spBodyOnLoadFunctionNames.push("loadmonth");
0
votes
0answers
102 views

spquery.query cannot be charged correctly

I'm charging my spquery with different parameters from a static class called Fields : In fact I'm using this query to bind result data to my asp:grid view using (SPSite mySite = new ...
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 ...
0
votes
1answer
97 views

SPLink.UrlParameter

Is there a way to assign value to Microsoft.SharePoint.SPLink.UrlParameter. From MSDN, I see that this is parameter is read only, but was wondering is there any setter function that would have access ...
0
votes
1answer
588 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 ...