The spsite tag has no wiki summary.
11
votes
3answers
1k 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 ...
4
votes
2answers
217 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 ...
3
votes
3answers
161 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 ...
3
votes
1answer
148 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 ...
2
votes
2answers
1k 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
198 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
1answer
63 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.
1
vote
6answers
4k 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 ...
1
vote
3answers
70 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
1answer
2k 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
532 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
365 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
245 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 ...
0
votes
3answers
280 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
4answers
896 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
2answers
481 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
1answer
102 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
2answers
592 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 ...
0
votes
3answers
755 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
...
0
votes
1answer
20 views
How to access a site on another machine in the same domain programmatically?
I have a site on DOMAIN\PC1 with url http://site1. I can access it by using following code (code is running on DOMAIN\PC1):
using(SPSite site = new SPSite("http://site1"))
{
}
Also there is a site ...
0
votes
1answer
185 views
Accessing SpSite from a Thread or ThreadPool
I have a couple of question regarding developing multithreading webparts in Sharepoint. First, let me explain the idea. I have a page with 5-7 different webparts. These webparts are constructed all in ...
0
votes
3answers
1k views
SPSite Credential
Hey , i created a sample application with take Site name as parameter and get all the list of that site, thats working fine on my local system , but it throws exception when i give the site address of ...
0
votes
1answer
765 views
How to get a document library URL from an SPSite object?
I have some documents in a document library in SharePoint 2007. The URL is http://abcd:24931/docu/Forms/AllItems.aspx.
I need to display these documents in a data grid view of a Windows form ...
0
votes
0answers
27 views
Sharepoint 2010 SPsite Class throws Exception- Console - Web App - WebService App(.asmx)
I am Searching for this Solution for PAST two Weeks,
I have Created 3 Apps thats uses Microsoft Sharepoint 2010, in Server 2008 Rs X64Bit MAchine
used the Sampe Piece of code in All Applicationswith ...
0
votes
0answers
64 views
Updating SharePoint 2010 list content types from a content hub.
Suppose I have a SP content type of "Project document". I also have several project sites, with document libraries containing this content type. Now I have created a subtype, "Extended Project ...
0
votes
1answer
162 views
SPSite - exception Microsoft.SharePoint.SPSecurity.GetRolesForUser
I am trying to open site(FBA enabled with custommembership & customroleprovider) through module/httpmodule. It is throwing error
System.NullReferenceException: Object reference not set to ...

