Questions tagged [spsite]

Represents a collection of sites in a Web application, including a top-level Web site and all its subsites.

Definition:

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.

More reading:

Code example:

//providing an absolute URL, 
SPSite mySiteCollection = new SPSite("http://mysharepointsite/");

//using the current context
SPSite mySiteCollection = SPContext.Current.Site;

SPSite implements the IDisposable interface so you should close the object when you no longer need it. This is not the case when you're object is assigned with the Context. So in the second line, the Dispose() should not be called. You can close it manually or use the using statement to do this for you:

//manually
mySiteCollection.Dispose();

//using statement
using (SPSite mySiteCollection = new SPSite("http://mysharepointsite/")
{
    //your code here
}
37 questions
0
votes
1 answer

SPSite for Sharepoint Online

newbie question, I have an office 365 E4 plan in the office and have been playing around with SharePoint. I reached a point where i need to code a few things. Can i use powershell and SPSite to connect to SharePoint online, ie not a local farm. I…
alex
  • 17
  • 4
0
votes
1 answer

Cannot access created sharepoint site from client machine other than server machine

SharePoint2013: I have installed SP2013 in windowsserver2008, I have chosen standalone server while configuring the server. I have created a toplevel site using Central Admin with Admin permissions. I opened the newly created site in the browser…
Rehman
  • 1
  • 6
0
votes
1 answer

Drop pdf file to sharepoint in asp.net

what's the best way to accomplish this task? (new to sharepoint) Do we need to install sharepoint on webserver in order to use sharepoint.dll/spsite object or just adding the reference to sharepoint.dll in asp.net is sufficient ? If yes then what…
SoftwareGeek
  • 15,234
  • 19
  • 61
  • 78
0
votes
0 answers

Use SpSite in Thread, ThreadPool, RegisterAsyncTask?

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 the same way, which means: a) the retrieve some…
Dani
  • 340
  • 3
  • 6
0
votes
2 answers

SPSite Directory Selection (C#)

I have a code that is running through all the Sites that we have created in SharePoint and finding the Sites that have documentation. When I create the SPSite object (?), I am defining a specific directory, but no matter what I seem to do, the…
Christopher
0
votes
2 answers

why my sharepoint workflow always stop when i use this code?

I need to find an user in a list to set the assignedto task property, these informations are in a list. So i use this method : public static SPUser GetSPUser(SPListItem item, string key){ SPFieldUser field = item.Fields[key] as SPFieldUser; …
LoKtO
  • 189
  • 2
  • 9
-1
votes
2 answers

How to upload a file in share point server from a local machine connected through lan using c#

I am really new to this share point stuffs.We have a share point server with admin account in it and i was connecting it from my local machine through ip and share point port manually. Nut i need to write a program which needs to upload the files…
Dah Sra
  • 4,107
  • 3
  • 30
  • 69
1 2
3