C# Class ProviderHostedCustomUIActionsWeb.SharePointContext

Encapsulates all the information from SharePoint.
ファイルを表示 Open project: CriticalPathTraining/SharePointAddinDemos Class Usage Examples

Protected Properties

Property Type Description
AccessTokenLifetimeTolerance System.TimeSpan
appOnlyAccessTokenForSPAppWeb DateTime>.Tuple
appOnlyAccessTokenForSPHost DateTime>.Tuple
userAccessTokenForSPAppWeb DateTime>.Tuple
userAccessTokenForSPHost DateTime>.Tuple

Public Methods

Method Description
CreateAppOnlyClientContextForSPAppWeb ( ) : ClientContext

Creates an app only ClientContext for the SharePoint app web.

CreateAppOnlyClientContextForSPHost ( ) : ClientContext

Creates app only ClientContext for the SharePoint host.

CreateUserClientContextForSPAppWeb ( ) : ClientContext

Creates a user ClientContext for the SharePoint app web.

CreateUserClientContextForSPHost ( ) : ClientContext

Creates a user ClientContext for the SharePoint host.

GetDatabaseConnectionString ( ) : string

Gets the database connection string from SharePoint for autohosted app.

GetSPHostUrl ( HttpRequest httpRequest ) : Uri

Gets the SharePoint host url from QueryString of the specified HTTP request.

GetSPHostUrl ( System.Web.HttpRequestBase httpRequest ) : Uri

Gets the SharePoint host url from QueryString of the specified HTTP request.

Protected Methods

Method Description
IsAccessTokenValid ( DateTime>.Tuple accessToken ) : bool

Determines if the specified access token is valid. It considers an access token as not valid if it is null, or it has expired.

SharePointContext ( Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber ) : System

Constructor.

Private Methods

Method Description
CreateClientContext ( Uri spSiteUrl, string accessToken ) : ClientContext

Creates a ClientContext with the specified SharePoint site url and the access token.

Method Details

CreateAppOnlyClientContextForSPAppWeb() public method

Creates an app only ClientContext for the SharePoint app web.
public CreateAppOnlyClientContextForSPAppWeb ( ) : ClientContext
return ClientContext

CreateAppOnlyClientContextForSPHost() public method

Creates app only ClientContext for the SharePoint host.
public CreateAppOnlyClientContextForSPHost ( ) : ClientContext
return ClientContext

CreateUserClientContextForSPAppWeb() public method

Creates a user ClientContext for the SharePoint app web.
public CreateUserClientContextForSPAppWeb ( ) : ClientContext
return ClientContext

CreateUserClientContextForSPHost() public method

Creates a user ClientContext for the SharePoint host.
public CreateUserClientContextForSPHost ( ) : ClientContext
return ClientContext

GetDatabaseConnectionString() public method

Gets the database connection string from SharePoint for autohosted app.
public GetDatabaseConnectionString ( ) : string
return string

GetSPHostUrl() public static method

Gets the SharePoint host url from QueryString of the specified HTTP request.
public static GetSPHostUrl ( HttpRequest httpRequest ) : Uri
httpRequest HttpRequest The specified HTTP request.
return System.Uri

GetSPHostUrl() public static method

Gets the SharePoint host url from QueryString of the specified HTTP request.
public static GetSPHostUrl ( System.Web.HttpRequestBase httpRequest ) : Uri
httpRequest System.Web.HttpRequestBase The specified HTTP request.
return System.Uri

IsAccessTokenValid() protected static method

Determines if the specified access token is valid. It considers an access token as not valid if it is null, or it has expired.
protected static IsAccessTokenValid ( DateTime>.Tuple accessToken ) : bool
accessToken DateTime>.Tuple The access token to verify.
return bool

SharePointContext() protected method

Constructor.
protected SharePointContext ( Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber ) : System
spHostUrl System.Uri The SharePoint host url.
spAppWebUrl System.Uri The SharePoint app web url.
spLanguage string The SharePoint language.
spClientTag string The SharePoint client tag.
spProductNumber string The SharePoint product number.
return System

Property Details

AccessTokenLifetimeTolerance protected_oe static_oe property

protected static TimeSpan,System AccessTokenLifetimeTolerance
return System.TimeSpan

appOnlyAccessTokenForSPAppWeb protected_oe property

protected Tuple appOnlyAccessTokenForSPAppWeb
return DateTime>.Tuple

appOnlyAccessTokenForSPHost protected_oe property

protected Tuple appOnlyAccessTokenForSPHost
return DateTime>.Tuple

userAccessTokenForSPAppWeb protected_oe property

protected Tuple userAccessTokenForSPAppWeb
return DateTime>.Tuple

userAccessTokenForSPHost protected_oe property

protected Tuple userAccessTokenForSPHost
return DateTime>.Tuple