Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [spweb]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
215 views

The version of the package is different from the current version this program supports

Goog day, I have the problem with site import between two site collections. SharePoint 2016. The site collections are from same SP Farm. I exported the site "http://Coll1.xxx.com/career" using the ...
Anonymous's user avatar
0 votes
1 answer
2k views

You cannot call a method on Null valued expression at: $File = $Web.GetFile([Guid]$Result.Id)

I have queried AllDocs table using Powershell and can see GUID values of Id, SiteId and WebId, But I am getting Error: You cannot call a method on Null valued expression at this line below: $File = $...
SPBeginer's user avatar
  • 2,547
0 votes
1 answer
301 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 ...
Lancelot's user avatar
  • 175
0 votes
1 answer
97 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") ...
Amir M's user avatar
  • 101
0 votes
1 answer
61 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 ...
Maro's user avatar
  • 125
1 vote
1 answer
588 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 ...
Frank Martin's user avatar
  • 3,668
0 votes
1 answer
470 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....
Goshky's user avatar
  • 2,058
0 votes
1 answer
32 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 ...
Natan Kara's user avatar
0 votes
2 answers
918 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?
raju's user avatar
  • 153
1 vote
1 answer
607 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/...
eflores's user avatar
  • 53
1 vote
2 answers
434 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 ...
Ythio Csi's user avatar
  • 185
0 votes
1 answer
12k 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 ...
John John's user avatar
3 votes
2 answers
4k 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 ...
ameliapond's user avatar
0 votes
1 answer
2k 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 ...
John John's user avatar
0 votes
1 answer
32 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(...
John John's user avatar
2 votes
2 answers
770 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 ...
John John's user avatar
0 votes
2 answers
109 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 ...
PeterMacko's user avatar
3 votes
1 answer
199 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 ...
user63126's user avatar
0 votes
4 answers
665 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 ...
VBartilucci's user avatar
4 votes
3 answers
318 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 ...
Ryden Choi's user avatar
0 votes
3 answers
231 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://...
rlv-dan's user avatar
  • 342
1 vote
1 answer
779 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/...
Syed Mauze Rehan's user avatar
7 votes
4 answers
516 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 ...
Ryden Choi's user avatar
3 votes
1 answer
283 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
Imen Turki's user avatar
  • 2,183
2 votes
1 answer
705 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 ...
Jacky's user avatar
  • 319
0 votes
1 answer
217 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 ...
Celia's user avatar
  • 41
4 votes
4 answers
160 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 ...
Goshky's user avatar
  • 2,058
0 votes
1 answer
1k 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. ...
Aadil Ganie's user avatar
2 votes
2 answers
355 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 ...
Ovais Khatri's user avatar
3 votes
3 answers
19k 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/...
SPBeginer's user avatar
  • 2,547
1 vote
2 answers
830 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 = "...
Rohander's user avatar
  • 421
1 vote
1 answer
179 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 ...
Vishwas Goswami's user avatar
2 votes
2 answers
325 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 ...
SPBeginer's user avatar
  • 2,547
1 vote
0 answers
141 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 ...
Onur Tolgahan Pamuk's user avatar
1 vote
1 answer
185 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?
mhbuur's user avatar
  • 549
0 votes
0 answers
219 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 (...
vapcguy's user avatar
  • 308
0 votes
1 answer
911 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 ...
KidBatman's user avatar
  • 381
1 vote
1 answer
531 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. ...
Ashish's user avatar
  • 401
0 votes
2 answers
32 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 ...
The Dag's user avatar
  • 103
1 vote
4 answers
6k 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 ...
Vilius's user avatar
  • 237
0 votes
1 answer
110 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 ...
XristosK's user avatar
  • 1,012
1 vote
0 answers
117 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 ...
contactmatt's user avatar
1 vote
1 answer
322 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.
user3426869's user avatar
0 votes
1 answer
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 ...
Karthikeyan's user avatar
  • 2,548
1 vote
2 answers
205 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)) { ...
Gennady G's user avatar
  • 1,623
2 votes
2 answers
2k 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....
Karthikeyan's user avatar
  • 2,548
0 votes
1 answer
309 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 ...
Nk SP's user avatar
  • 2,873
1 vote
3 answers
12k 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();
SPBeginer's user avatar
  • 2,547
1 vote
2 answers
5k 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....
TheUnexpected's user avatar
0 votes
1 answer
576 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
Markus Fritz's user avatar