Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [spweb]

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

0
votes
1answer
42 views

SPWeb object properties turn to “null reference exception”

I am currently working a Farm Solution that is supposed to work with SharePoint 2016 and I am facing something that I can't understand. Maybe someone could explain this phenomenon or point what I am ...
0
votes
1answer
25 views

SharePoint 2013 - Getting SPSite.Url from SharePoint DB

I'm working directly against the SharePoint DB (I know it is highly not recommended but I need to, for several reasons). I'm trying to get the SPSite.Url property ("http://baseurl/sites/somename") ...
0
votes
1answer
35 views

Should i use “using” inside event receiver

I'm confused if i should use the using statement inside an event because the event is "asynchronous" and the object can be disposed before ending the job. Or am i missing something public override ...
1
vote
1answer
169 views

Group cannot be found

I am getting error Group cannot be found when I use following code: string group = GetGroupName("1"); SPUser user = web.SiteGroups[group].Users.GetByID(SPContext.Current.Web.CurrentUser.ID); But ...
0
votes
1answer
84 views

SP16 - Change Web top navigation with PowerShell

I want to change navigation in my website with powershell This is my code: function SettingUpNavigation($webURL){ $spWeb = Get-SPWeb -Identity $webURL $SPPubWeb = [Microsoft.SharePoint....
0
votes
1answer
26 views

Page title cannot be set

Cannot set programmatically the title of my SP page - i mean to the SPWeb object: web.Title = "..."; web.Update(); The changes are set only after one more refresh of the page. But i need the correct ...
0
votes
2answers
188 views

SPContext.Current is null while calling SPContext.Current.Web.EnsureUser() method

SPContext.Current is null while calling SPContext.Current.Web.EnsureUser() method. Any suggestions?
1
vote
1answer
165 views

Empty properties? when I call $web.GetFile() method from Powershell

I wonder why when I execute this two lines $wpDestinationPageFullUrl = "http://root/sites/SitioModelo/TestLoadWebPart/SitePages/HomeTest.aspx" $siteUrl = "http://root/sites/SitioModelo/...
1
vote
2answers
171 views

How to check if a subweb exists within a web

How can i check if a subweb exists among SPWeb.Webs ? If i try web.Webs["SubWeb"] it will rise an exception. Is the following solution clean ? SPWeb webfound= null; foreach (SPWeb subweb in ...
0
votes
1answer
2k views

Where will EnsureUser() method add users, and how it is going to validate users

I was searching for a method which returns SPUser object based on the display name of the user, and I found the EnsureUser() method. as I want to use this method inside my SharePoint server 2013 event ...
2
votes
2answers
477 views

Get all groups for a specific web site (NOT SITE COLLECTION) using powershell?

I would like to know how to get all groups of a specific web site using powershell. I do know that all groups are defined at the site collection level but when browsing in a specific web, it only ...
0
votes
1answer
372 views

Modifying a list item field using powershell without changing the following values (modifed/modifiedby/Version)

I have a list which contain the built-in Description field (internal name = comment) which is if type "Rich Text",now i have created a new site column of type "Enhanced Rich Text" named "Custom ...
0
votes
1answer
24 views

incorrect documentation about the SPItemEventProperties.OpenWeb() method inside visual studio 2012

I have the following event receiver which will get fired when a custom list item is created, and the event receiver is scoped at the site level.:- public override void ItemAdded(...
2
votes
2answers
188 views

Why SPWeb.Group provide a method named Add() that always raises exceptions (that we can not use)

I have the following inside my c# console application using (SPSite site = new SPSite(scurl)) //site collection url { using (SPWeb web = site.OpenWeb(subsiteurl0)) //specific subsite url ...
0
votes
2answers
67 views

Open web in privileges mode and use it outside

I'm often using pattern where I create class Workspace. This class has some basic functionality and on of them is opening of webs, and also web in privilege mode: public class Workspace : IDisposable ...
3
votes
1answer
115 views

Cannot get Webs of SPSite object

I try to get all webs of an SPSite (via Powershell) on a SharePoint 2010. First I tried to get all the webs like this: $site = Get-SPSite http://<url> $webs = $site.AllWebs Every time tried ...
0
votes
4answers
259 views

Space in URL causes fail in get-spweb?

The issue - I have a number of SP 2010 webs under a main address, as in http://mysite/webname1 http://mysite/webname2 http://mysite/web name 1 http://mysite/web name 2 Doing a Get-SPWeb for the ...
4
votes
3answers
165 views

How to get the value of list count in SPWeb level?

Hi i`m making a Windows application that analyse the SharePoint Site. In SPWeb level, I want to get the value of list count. I tried to like this SPWeb.Lists.Count.ToString(); But when I compare ...
0
votes
3answers
181 views

Determine path to site from a given URL

Suppose I have the URL to a file. How can I determine the path to the (sub)site (spweb) it is hosted on, using JavaScript. Here are some examples. Bolded text is what I am looking for: https://...
1
vote
1answer
380 views

How do I differentiate between getchanges REST API call for SPSite and SPWeb?

I'm trying to query SPSite for changes but I can't seem to figure out the difference between that and querying SPWeb. I'm following this documentation https://msdn.microsoft.com/en-us/library/...
7
votes
4answers
371 views

How can I count Document library in Sites(SPWeb) Level?

I`m making SharePoint site Analysis program. And I have a question. In Sites(SPWeb) Level, I want to count document library. So I`m using SPWeb.DocTemplate Property like this. public class ...
3
votes
1answer
120 views

cant find /_layouts/AreaTemplateSettings.aspx

I try to save my spweb as template but i dont have this page on my site how can I get it , even my web is a publishing site) my template site is :CMSPUBLISHING #39
2
votes
1answer
458 views

When to dispose SPWeb and SPSite objects

I am writing code in feature receiver, and I am wondering when to dispose SPWeb and SPSite objects. For example, I have this in my code: SPWeb web = properties.Feature.Parent as SPWeb; Do I ...
0
votes
1answer
84 views

SPListTemplateType.DocumentLibrary cannot be used to create a library

I want to create a new Document Library using server side code and I try to use SPListTemplateType.DocumentLibrary inside SPWeb.Lists.Add() method but it won't allow me. I have to used ...
4
votes
4answers
150 views

SP - What is the reason to use “using” in WebParts

I want to know, what is the reason to use "Using" like this: using (SPSite oSite = new SPSite("www.contoso.com")) { using (SPWeb oWeb = oSite.OpenWeb()) { **my code here......** } } How ...
0
votes
1answer
733 views

Import-SPWeb Into Host Named Site Collection

I have made a backup of a SharePoint Site using Export-SPWeb. I have also added a new Host Named Site Collection and I would like to Import the Site into this newly created Host Named Site Collection. ...
2
votes
2answers
106 views

SPWeb.Exists returns true for web don't exists

Below snippet returns true for invalid web URL: using (SPSite site = new SPSite(url)) { using (SPWeb web = site.OpenWeb()) { return web.Exists; } } Web was created and deleted ...
3
votes
3answers
15k views

How to get specific sub sites Using Get-SPWeb object

In the code below i only want to get following 3 specific subsites using Get-SPWeb Object. which filter command is most appropriate to target only these 3 sites 1. http://myCo.root.site/sites/News/...
1
vote
2answers
406 views

How can you change a rootweb name, url etc?

How can I change the name on a root web? Right now it's http://dev1/sites/dog. I am trying to change it to http://dev1/sites/cat I have tried $web = get-spweb http://dev1/sites/dog $web.Name = "...
1
vote
1answer
93 views

Effect of using multiple SPSite and SPWeb objects

I want to know that what effects will cause if I open SPSite and SPWeb objects more than once in a code file (c#) I have a implementation like below, can anyone tell me that what effects will it ...
2
votes
2answers
188 views

Dispose should not be called on this object. // SPDisposeCheck comment

In the code below, within using directive, for rootweb, Dispose(); method will be called implicitly, is that correct? Or should I need a using directive for this: SPWeb rootweb = site.RootWeb since I ...
1
vote
0answers
97 views

Timeout using SPsite object and U2U Caml query

We have 2 collection. 1 is test and other is production environment. In test collection, I'm writing console application which is using SPSite and SPWeb objects. But it takes nearly 40minutes to get ...
1
vote
1answer
98 views

Detecting change in users/groups on web

I want to execute some code when the users/groups with access to a web changes (addition and removal of users/groups). What are my options?
0
votes
0answers
139 views

How to tell if a person has modified any content on a SharePoint site programmatically?

We need to find out if a disgrunted employee has modified any content on any number of many SharePoint sites we have. Aside from how we are currently reviewing lists by modified date manually (...
0
votes
1answer
614 views

Using EnsureUser with ADFS

I am trying to take some users and author them to list item posts. The SPWeb.EnsureUser() method works fine on a server only utilizing AD, but not one that is using ADFS. Here is my attempt at ...
1
vote
1answer
316 views

ThreadAbortException on SPWeb.ProcessBatchData

I am trying to update ~2000 list items with SPWeb.ProcessBatchData. After exception on all items at a time, I tried them in small batches like 100 and 200 but after executing first 1 or 2 batches i.e. ...
0
votes
2answers
26 views

Ideas underpinning SPSite and SPWeb [duplicate]

Edit: I'm not sure this will help, but I'll try: I am asking "what's the whole idea with wheels?"; a list of wheel parts is not what I am after. /edit I'm aware that SPSite - despite the confusing ...
0
votes
2answers
4k views

Removing SPWeb properties from its property bag with powershell

I need to remove properties from multiple places with powershell script. I tried many examples from net, with null assigning and using remove on Properties and AllProperties, or using method ...
0
votes
1answer
93 views

Error passing spweb and splist variables as function parameters

I need to pass SPWeb an SPList as function parameters: string check(SPWeb web1, SPList splist1){} Yet, web1.Title, splist1.Title throws errors: There is no Web named "/http://DevSite". Is there ...
1
vote
0answers
110 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
257 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
1k 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
198 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
836 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 = SPContext....
0
votes
1answer
206 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 ...
1
vote
3answers
8k 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();
1
vote
2answers
4k 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 "export....
0
votes
1answer
441 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
1answer
903 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: http://server/sites/mysite/myweb/Lists/...
2
votes
1answer
439 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 ...