A member of the Microsoft.SharePoint namespace, SPSite represents a collection of sites in a Web application, including a top-level Web site and all its subsites. Each SPSite object, or site collection, is represented within an SPSiteCollection object that consists of the collection of all site ...

learn more… | top users | synonyms

12
votes
10answers
23k views

SPSite - The Web application at <address> could not be found

I'm trying to use SP 2010 site from a web application and when I create a new instance of SPSite I get this error: The Web application at could not be found. Verify that you have typed the URL ...
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 ...
9
votes
1answer
648 views

What does SPSite.LastContentModifiedDate track?

What causes SPSite.LastContentModifiedDate to be updated with a later date? Does it track: changes to the definition of lists/fields/content types or just the content stored in them? changes to ...
4
votes
3answers
1k views

SPSite.Exists returning true for a just deleted site collection

Short story - I have a process that creates some sitecollection, so to test it I keep deleting and recreating the same site over and over. The process includes a check with the istruction SPSite.Exits,...
4
votes
2answers
735 views

Can you call SPSite on a different machine to SharePoint setup?

I'm trying to call SharePoint from within a standard .NET class library. This will probably be hosted on a different server to SharePoint. I just need to return an item from a list, and wondered if I ...
4
votes
1answer
58 views

Using Visual Studio, how can I reference a SharePoint 2010 site collection outside of the development machine?

I am creating a custom web service which needs to reference a specific site collection on our SharePoint 2010 farm. The web service is on a development machine not part of the farm (although ...
4
votes
1answer
339 views

Setting an SPSite to read-only from Application Page

We are trying to make a site read-only from the code-behind of an application page. When executing the code-snippet from a timer job or a console application it works perfectly, but it throws an ...
3
votes
2answers
824 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 ...
3
votes
1answer
191 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 ...
3
votes
1answer
551 views

Maximum length of SPSite Name and Description property values

Is there any reference to the maximum size for the Name and Description properties of a site collection?
3
votes
3answers
29 views

Create a Field that only accepts SharePoint groups

I need to create a SharePoint 2013 field that only accepts groups (from SP, not AD). I know I can add UserSelectionMode="PeopleOnly" to make it accept only people, but I want the opposite. Is there ...
2
votes
2answers
159 views

Need comments for code within SPSecurity.RunWithElevatedPrivileges

I am investigating the below code to make sure if its quality is as per Microsoft standards. Actually Comments came from Microsoft code reviewer that we need to create new SPSite Object within the ...
2
votes
2answers
2k views

How do I get an SPSite from SPWebEventProperties?

How do I get an SPSite object from the SPWebEventProperties object passed into the SPWebEventReceiver.WebProvisioned method? public override void WebProvisioned(SPWebEventProperties properties)
2
votes
2answers
2k views

Powershell Enumerate through all site collections but not include one specific site collection

I am partially not even sure how to Google this question because whatever I type never seems to bring back any relevant search results. I currently have a working script that is set to go through and ...
2
votes
2answers
47 views

Problem with RunWithElevatedPrivileges and Context

I'm trying to modify two properties I have in several documents in my SharePoint library. This is the code I use to get into the library: public SPArchiveBDI(string sharepointsite, string ...
2
votes
2answers
180 views

SPSite.Exists always returns false

I am trying to determine if a site collection exists, but the SPSite.Exists method always seems to return false regardless if the site collection exists or not. Snipp: bool exists; Uri uri = new Uri(...
2
votes
4answers
766 views

SharePoint 2013 Using SPSite in Custom WCF Content Enrichment Webservice

I have to write a content enrichment webservice which retrieves data from an specific SharePoint Site (SPSite). But my code doesn't run, if i make a new SPSite Object. Also no logging information in ...
2
votes
1answer
147 views

Is there any way to validate site ID without instantiating SPSite?

I need a fast way to ensure that site ID is correct. Instantiating SPSite seems to be quite expensive, so may be there are other options to do this.
2
votes
2answers
851 views

SPSite.Usage.Storage And SPSite.StorageManagementInformation Are Returning Different Values

When every I use SPSite.Usage.Storage and I use SPSite.StorageManagementInformation with to retrieve all the documents for the Site Collection then I sum the sizes of all the documents then I get a ...
1
vote
1answer
7k views

Is it possible to get an SPList object with just a Url?

I have a url field that contains the url of a Discussion board that I will be creating a new item for. Thing is this discussion board can be in any site or web. So far I have two ideas but would like ...
1
vote
2answers
5k 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
3answers
3k 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
7k views

What is difference between SPContext.Current.Web.URL and SPContext.Current.Site when using SPSite object?

SPSite spsite1=new SPSite(SPContext.Current.Web.URL); SPSite spsite2=SPContext.Current.Site; What is the difference and when do we decide which one to use? I feel both give us the site collection ...
1
vote
1answer
62 views

Can we put an SPWeb object into a SPSite object?

This is possible: using (SPSite site = new SPSite(SPContext.Current.Site.WebApplication.Sites[0].Url)) Is this possible?: using (SPSite site = new SPSite(SPContext.Current.Site.WebApplication....
1
vote
1answer
3k views

Share List between subsites of sharepoint2010

Anyone know how can we share one subsites list to another subsite ? I want to allow all operations also and also want to put in read only mode in another subsite. Anyone have idea how can i do this ?
1
vote
1answer
58 views

Error Acessing Remote SharePoint 2010 sites within same network from .NET 3.5 Windows Application

We have been working on a .NET Windows Application for doing Admin tasks and some validation in SharePoint 2010 , since the tool needs to have the functionality to do a site backup and restore I have ...
1
vote
3answers
154 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
60 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
37 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 ...
1
vote
1answer
153 views

Best way of retrieving a collection of SPSite in code

I have a page where the user will be entering a data in a textbox, and click submit, and it brings all site collections that url contains this data in textbox, I am currenlty doing a Linq query to ...
1
vote
1answer
354 views

Best way to copy site collections

I am looking in to copying a whole SP 2013 collection to a new one. (target URL could be in the same server or farm, though unlikely) I want to mention that, this is meant to be a 'copy machine' to ...
1
vote
1answer
666 views

NullReferenceException when instantiating UserProfileConfiguration

I'm following the instructions at How to: Create and Edit a User Profile Property. I keep getting a NullReferenceException on the call to the UserProfileConfigManager constructor. The context ...
1
vote
1answer
1k views

Values in SPSite.UsageInfo are always zero

I am trying to retrieve information about site usage via SPSite.UsageInfo programatically or via PowerShell. Here is simple PowerShell code: $site = Get-SPSite "http://intranet" $site.Usage And it ...
1
vote
0answers
37 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
0answers
62 views

Programmatically created SPWebApplication's WebParts not registered as safe

I am having a frustrating issue with a programmatically created web application in which a programmatically deployed solution's web parts are not registered as safe when adding to a programmatically ...
1
vote
0answers
37 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
67 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.
1
vote
1answer
1k views

Microsoft SharePoint is not supported with version 4.0.30319.1 of the Microsoft .Net Runtime

I am developing a windows service in C# and adding dll for SharePoint. I have added reference from C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint....
0
votes
3answers
2k 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?
0
votes
4answers
486 views

SPSite URL value

Hello I am trying to fetch a list item and want to know if this is a good practice. SPSite spsite = new SPSite(SPContext.Current.Web.Url); SPWeb spWeb = spsite.RootWeb; ...
0
votes
4answers
6k 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
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 ...
0
votes
1answer
840 views

What is difference between SPSite.Url and SPSite.RootWeb.Url

What is difference between: SPSite.Url SPSite.RootWeb.Url If both are same, Which is considered to be good practice?
0
votes
2answers
574 views

What is difference between SPSite spSite = SPContext.Current.Site; and SPSite spsite = new SPSite(SPContext.Current.Web.Url)

What is difference between SPSite spSite = SPContext.Current.Site; and SPSite spsite = new SPSite(SPContext.Current.Web.Url) Which is good practice?
0
votes
3answers
3k views

Error creating SPSite using powershell

I am trying to create a web application "http://Intranet" and a site collection "http://Intranet" on SharePoint 2013 foundation farm. Here is my code $sp = New-SPAuthenticationProvider $web = New-...
0
votes
2answers
424 views

How to get SPSite in ASP.NET Web Site Project

I'm trying to use SP 2010 site from ASP.NET Web Site Project and when I create a new instance of SPSite I get this error: The Web application at could not be found. Verify that you have typed the URL ...
0
votes
2answers
2k views

Get all SPLists for a site collection

I feel like I'm very close on this one. I know how to get the root site collection from this: How can I get the root site collection from SPContext.Current? I've been messing around with ...
0
votes
3answers
3k views

SPSite Object Problem When Trying To Loop Through Sites

I'm working in a Sharepoint 2007 environment. I'm trying to loop through a site, and it's subsites, and add a webpart to any pages found. #Add SharePoint assemblies [system.reflection.assembly]::...
0
votes
1answer
122 views

How do I read pagecolumns from the current page

I know that I have to use SPSite site = new SPSite("SPsite Path"); SPWeb web = site.OpenWeb(); SPList contacts = web.Lists["Listname"]; if I need to get content of a List, but how do I read data ...
0
votes
1answer
113 views

Using Get-SPSite -Filter

I seem to be having some trouble using the Filter parameter on the Get-SPSite cmdlet. Using this question for reference, I'd hoped to filter out the Site that I was getting, to later on exclude it ...