Search Results for

    Show / Hide Table of Contents

    Class HttpHelper

    Static class full of helper methods to make HTTP requests

    Inheritance
    System.Object
    HttpHelper
    Namespace: PnP.Framework.Utilities
    Assembly: PnP.Framework.dll
    Syntax
    public static class HttpHelper : object

    Fields

    JsonContentType

    Declaration
    public const string JsonContentType = null
    Field Value
    System.String

    Methods

    MakeDeleteRequest(String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP DELETE request

    Declaration
    public static void MakeDeleteRequest(string requestUrl, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    MakeGetRequestForStream(String, String, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP GET request and returns the result as a String

    Declaration
    public static IO.Stream MakeGetRequestForStream(string requestUrl, string accept, string accessToken = null, string referer = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.String accept

    The accept header for the response

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    System.String referer

    The URL Referer for the request

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    System.IO.Stream

    The Stream of the result

    MakeGetRequestForStreamWithResponseHeaders(String, String, out HttpResponseHeaders, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP GET request and returns the result as a String

    Declaration
    public static IO.Stream MakeGetRequestForStreamWithResponseHeaders(string requestUrl, string accept, out HttpResponseHeaders responseHeaders, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.String accept

    The accept header for the response

    HttpResponseHeaders responseHeaders

    The response headers of the HTTP request (output argument)

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    System.IO.Stream

    The Stream of the result

    MakeGetRequestForString(String, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP GET request and returns the result as a String

    Declaration
    public static String MakeGetRequestForString(String requestUrl, String accessToken = null, String accept = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    String requestUrl

    The URL of the request

    String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    String accept

    The value for the accept header in the request

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    String

    The String value of the result

    MakePatchRequestForString(String, Object, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP PATCH request and returns the result as a String

    Declaration
    public static string MakePatchRequestForString(string requestUrl, object content = null, string contentType = null, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.Object content

    The content of the request

    System.String contentType

    The content/type of the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    System.String

    The String value of the result

    MakePostRequest(String, Object, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP POST request without a response

    Declaration
    public static void MakePostRequest(string requestUrl, object content = null, string contentType = null, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.Object content

    The content of the request

    System.String contentType

    The content/type of the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    MakePostRequestForHeaders(String, Object, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP GET request and returns the result as a String

    Declaration
    public static HttpResponseHeaders MakePostRequestForHeaders(string requestUrl, object content = null, string contentType = null, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.Object content

    The content of the request

    System.String contentType

    The content type for the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    HttpResponseHeaders

    The Stream of the result

    MakePostRequestForString(String, Object, String, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP POST request and returns the result as a String

    Declaration
    public static string MakePostRequestForString(string requestUrl, object content = null, string contentType = null, string accessToken = null, string accept = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.Object content

    The content of the request

    System.String contentType

    The content/type of the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    System.String accept

    The value for the accept header in the request

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    System.String

    The String value of the result

    MakePutRequest(String, Object, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP PUT request without a response

    Declaration
    public static void MakePutRequest(string requestUrl, object content = null, string contentType = null, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.Object content

    The content of the request

    System.String contentType

    The content/type of the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    MakePutRequestForString(String, Object, String, String, Dictionary<String, String>, Dictionary<String, String>, Int32, Int32, String, ClientContext)

    This helper method makes an HTTP PUT request and returns the result as a String

    Declaration
    public static string MakePutRequestForString(string requestUrl, object content = null, string contentType = null, string accessToken = null, Dictionary<string, string> requestHeaders = null, Dictionary<string, string> cookies = null, int retryCount = 1, int delay = 500, string userAgent = null, ClientContext spContext = null)
    Parameters
    System.String requestUrl

    The URL of the request

    System.Object content

    The content of the request

    System.String contentType

    The content/type of the request

    System.String accessToken

    The OAuth 2.0 Access Token for the request, if authorization is required

    Dictionary<System.String, System.String> requestHeaders

    A collection of any custom request headers

    Dictionary<System.String, System.String> cookies

    Any request cookies values

    System.Int32 retryCount

    Number of times to retry the request

    System.Int32 delay

    Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry

    System.String userAgent

    UserAgent string value to insert for this request. You can define this value in your app's config file using key="SharePointPnPUserAgent" value="PnPRocks"

    ClientContext spContext

    An optional SharePoint client context

    Returns
    System.String

    The String value of the result

    Back to top PnP Framework
    Generated by DocFX with Material UI
    spacer