-
Notifications
You must be signed in to change notification settings - Fork 11
/
SPOSiteContext.cs
52 lines (42 loc) · 1.27 KB
/
SPOSiteContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using Lapointe.SharePointOnline.PowerShell.Data.Sites;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Lapointe.SharePointOnline.PowerShell
{
public class SPOSiteContext
{
private static SPOSiteContext _currentSiteContext = null;
private SPOSite _site = null;
private SPOSite _detailedSite = null;
public SPOSiteContext(CmdletContext context)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
this.Context = context;
}
public CmdletContext Context { get; protected set; }
internal static SPOSiteContext CurrentSiteContext {
get { return _currentSiteContext; }
set { _currentSiteContext = value; }
}
public string Url
{
get
{
return this.Context.Url;
}
}
public SPOSite GetSite(bool detailed)
{
if (_detailedSite != null) return _detailedSite;
if (_site != null && !detailed) return _site;
var site = Context.Site;
SPOSite.LoadSite(Context, site, detailed);
return new SPOSite(site);
}
}
}