Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7994319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:06:02+00:00 2026-06-04T14:06:02+00:00

I realise this is a silly question but the MSDN can’t be accessed from

  • 0

I realise this is a silly question but the MSDN can’t be accessed from my network "Server Error: 502 - Web server received an invalid response while acting as a gateway or proxy server." and I can’t just sit here and twiddle my thumbs.

I know of no alternative to the MSDN, and my local Visual Studio help thing doesn’t have anything on this class.

Please could someone copy and paste the entries for Microsoft.Sharepoint SPSite class, specifically the Constructor but the whole article would be useful.
I am getting a FileNotFoundException and need to know how the URL property is supposed to be formatted.

In case any of you just happen to know.

    public Dictionary<string, SPFolder> GetFolderCollection(string siteURL, string docLibraryName)
    {
        using (SPSite oSite = new SPSite(siteURL + ":23179"))
        {
            SPWeb oWeb = oSite.OpenWeb();
            SPList oList = oWeb.Lists[docLibraryName];

            SPFolderCollection oFolders = oList.RootFolder.SubFolders;

            foreach (SPFolder folder in oFolders)
            {
                foundFolders.Add(folder.Name, folder);
            }
            return foundFolders;
        }
    }

Edit: Cheers, google cache ftw.

For the record I was pointing to the IIS site root, not the Sharepoint “Site”. Was confusing the Sharepoint terminology.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:06:03+00:00Added an answer on June 4, 2026 at 2:06 pm

    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 collections in the Web
    application.

    Inheritance Hierarchy

    System.Object
    Microsoft.SharePoint.SPSite

    Namespace: Microsoft.SharePoint

    Assembly: Microsoft.SharePoint (in
    Microsoft.SharePoint.dll)

    Available in Sandboxed Solutions: Yes

    Available in SharePoint Online

    [SubsetCallableTypeAttribute] [ClientCallableTypeAttribute(Name =
    “Site”, ServerTypeId = “{E1BB82E8-0D1E-4e52-B90C-684802AB4EF6}”)]
    public class SPSite : IDisposable

    Remarks

    To instantiate an SPSite object for a specific site collection on an
    ASP.NET page, or for a specific site collection within a console
    application, use the SPSite constructor as follows: C# VB

    SPSite oSiteCollection = new SPSite(“Absolute_URL”);

    Within an ASP.NET application, you can use the Site property of the
    SPContext class to return an SPSite object that represents the current
    site collection, as follows: C#

    SPSite oSiteCollection = SPContext.Current.Site;

    Use the Sites property of the SPWebApplication class to return an
    SPSiteCollection object that represents the collection of site
    collections in a SharePoint Web application. Use an indexer to return
    a single site collection from the collection. For example, if the
    collection of site collections is assigned to a variable named
    oSiteCollections, use oSiteCollections[index] in C#, or
    oSiteCollections(index) in Visual Basic, where index is either the
    display name or the index number of the site collection in the
    collection.

    Certain objects implement the IDisposable interface, and you must
    avoid retaining these objects in memory after they are no longer
    needed. If you create your own SPSite object, you can use the Dispose
    method to close the object. You can also instead implement a using
    statement so that the .NET Framework common language runtime (CLR)
    automatically releases the memory that is used to store the site
    collection as follows: C# VB

    using (SPSite oSiteCollection = new SPSite(“Absolute_URL”) {
    … }

    However, if you have a reference to a shared resource, such as when
    the object is provided by the GetContextSite method in a Web Part, do
    not use either method to close the object. Using either method on a
    shared resource causes an Access Violation error to occur. In
    scenarios where you have a reference to a shared resource, instead let
    Microsoft SharePoint Foundation or your portal application manage the
    object.

    For more information about good coding practices, see Disposing
    Objects.

    Important

    If you install Infrastructure Update for Windows SharePoint Services
    3.0 (KB951695), custom solutions may fail if they call the SharePoint object model while impersonation is suspended. If you use Windows
    authentication and your code calls the SharePoint object model from an
    Internet Information Services (IIS) worker process, the request must
    impersonate the calling user’s identity. SharePoint Foundation
    configures ASP.NET to impersonate the calling user automatically, but
    your code may work unexpectedly, or fail, if you suspend
    impersonation–for example, by calling the RevertToSelf function of
    the Windows API, or by calling the
    System.Security.Principal.WindowsIdentity.Impersonate method and
    passing IntPtr.Zero as the value of the user token parameter. Even if
    your code does not explicitly revert to self, it might be called by
    ASP.NET after it reverts to self, such as happens when implementing a
    virtual path provider; if your code does not impersonate the calling
    user, it might not function properly.

    Thread Safety

    Any public static
    (Shared in Visual Basic) members of this type are thread safe. Any
    instance members are not guaranteed to be thread safe.

    Constructors:

        Name    Description
    Public method   SPSite(Guid)    Initializes a new instance of the SPSite class based on the specified ID for a site collection.
    Public method   SPSite(String)  Initializes a new instance of the SPSite class based on the specified URL.
    Public method   SPSite(Guid, SPUrlZone)     Initializes a new instance of the SPSite class based on the specified site collection GUID and URL zone.
    Public method   SPSite(Guid, SPUserToken)   Initializes a new instance of the SPSite class based on the specified site collection GUID and user token.
    Public method   SPSite(String, SPUserToken)     Initializes a new instance of the SPSite class based on the specified absolute URL and user token.
    Public method   SPSite(Guid, SPUrlZone, SPUserToken)    Initializes a new instance of the SPSite class based on the specified site collection GUID, URL zone, and user token.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a bit of a vague question I realise, but I've been looking
I realise this is an incredibly noob question, but I've googled for it and
I realize that this may sound like a silly question, but the last time
I realise this is a very similar question to Stop SSMS from scripting SPs
This may be a silly question but I was writing a quick test page
I realise this question has been asking before, but I've yet to find an
I realize this is probably a silly question, but... If I'm chaining a bunch
I know this is a silly question and I feel so stupid , but
I realise this question has been asked before, but after going through the previously
This may be a silly question, but it may shed some light on how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.