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

learn more… | top users | synonyms

1
vote
0answers
12 views

Best practice for re-using the SPWeb object across code layers/services

I have several services that use the SPWeb object. These services are called to perform various functions, sometimes completely unrelated. i.e. an AuthenticationService uses SPWeb to get information ...
1
vote
1answer
18 views

Determine if object is SPSite or SPWeb

I have a simple question, how to determine with PowerShell if a SharePoint Site is a SPSite object or SPWeb? I get all Site followed by user but some are SPSite.
0
votes
1answer
728 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
1answer
33 views

How to use the AllowUnsafeUpdates on the LayoutsPageBase in SharePoint 2013?

I am trying create an application page and want to make sure that AllowUnsafeUpdates property is properly used. Please suggest me the proper usage of AllowunsafeUpdates from the following code. I ...
1
vote
2answers
184 views

Code Review Question about disposing

Don't web.Dispose() dispose parent SPSite object? Is it Ok if I do this in web part? { SPSite site = SPContext.Current.Site; using (SPWeb web = site.OpenWeb(s)) { ...
2
votes
2answers
29 views

When should I set the AllowUnsafeUpdates property? [duplicate]

It mentioned that we should set "AllowUnsafeUpdates" to true, when the web object is not created from the SPContext. However should I still need to set as mentioned below? SPWeb web = ...
0
votes
1answer
44 views

Remove-SPWeb - content database

Does the command Remove-SPWeb remove the web also from the content DB? I have a site collection with 10 webs, the size is around 100GB, I wish to remove some webs and reduce the size of the content ...
0
votes
3answers
2k 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 ...
4
votes
4answers
4k 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 ...
1
vote
3answers
205 views

Site.OpenWeb() VS Site.RootWeb()

Just want to clarify between the two: what web variable will hold in both cases: SPWeb web = Site.OpenWeb(); SPWeb web = Site.RootWeb();
0
votes
1answer
216 views

Import-SPWeb error: “The file xxx.cmp does not exist.”

I have a strange issue with Export-SPWeb and Import-SPWeb for SharePoint 2013. I want to export one of my sites, so I type this command: Export-SPWeb https://test.mywebsite.com/site -Path ...
0
votes
1answer
26 views

Sharepoint 2013 Search: Get parent web information

I've a search result of different webs and I Need to know to which parent web they belong. Is it possible via search to get Information from the parent object? Thank you Markus
0
votes
0answers
12 views

Updates are currently disallowed on Get requets, Code behind trying to update list item

I am using the below code to get id from url and get list item, then update it. But i am getting an error Updates are currently disallowed on Get requets. To allow updates on a GET , set ...
0
votes
1answer
113 views

How to get the URL of an item's parent web in JavaScript?

Given an absolute URL to an item, like: http://server/sites/mysite/myweb/Lists/MyList/DispForm.aspx?ID=1 or the absolute URL to the item's parent list, like: ...
2
votes
1answer
79 views

Get-SPWeb with a cross domain url throws an excepton

I want to migrate list items held in our dev sharepoint farm to site collection hosted on our live farm. Ok I have RDPed onto the server and I am running ISE as administrator I do another account I ...
0
votes
1answer
1k 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 ...
0
votes
1answer
20 views

Question on SP 2013 calculation

reguarding this questiong How do i Generate different calculations depending on what item is selected in drop down box? How would I do this calculation? while the calculation for ISDN is = ((len_26 ...
0
votes
0answers
163 views

Export-SPWeb 'These columns don't currently have unique values' fatal error

I'm trying to export some webs via Export-SPWeb in powershell and I'm receiving: FatalError: These columns don't currently have unique values. The webs have been added to SharePoint 2013 but ...
0
votes
1answer
84 views

SPWeb.GetListItem behavior

I am currently trying to retrive a Sharepoint item given it's URL. The URL would be an absolute URL or a relative URL. To achieve this, I am using the SPWeb.GetListItem(string url) method. I observed ...
1
vote
2answers
850 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 ...
0
votes
1answer
177 views

SP 2013: Moving subwebs within a site collection

Just wondering if anyone knows a quick solution for moving SPWebs, they need to be structurally moved (So no managed navigation solution) and they contain an SPWeb hierarchy (Export/import is out of ...
0
votes
1answer
227 views

Get a sharepoint web name from sharepoint site

spsite site =new spsite(/sites/gvr/); spweb web=site.openweb(); I'm getting all my subsites here, like /sites/gvr/test1 sites/gvr/test I need only subsite name like test1 or test2. Please let ...
2
votes
4answers
3k 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?
3
votes
2answers
8k 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
1answer
919 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
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
3answers
232 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
598 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
481 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
205 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
183 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
965 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
159 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
778 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 ...
3
votes
1answer
269 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
192 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
2answers
46 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
251 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
15 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
290 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
3k 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
189 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
3k 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
2k 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 ...
3
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
110 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
7k 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
132 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
157 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 ...