Codeunit 9107 SharePoint Http Content in 27

App
System Application
Namespace
System.Integration.Sharepoint

Procedures, 11

Versions171819202122232425262728latest

Source242526272829

Source in 27

src/System Application/App/SharePoint/src/helpers/SharePointHttpContent.Codeunit.al96 lines, Copyright (c) Microsoft Corporation. MIT

// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
// ------------------------------------------------------------------------------------------------

namespace System.Integration.Sharepoint;

using System;

codeunit 9107 "SharePoint Http Content"
{
    Access = Internal;
    InherentEntitlements = X;
    InherentPermissions = X;

    var
        HttpContent: HttpContent;
        ContentLength: Integer;
        ContentType: Text;
        RequestDigest: Text;
        XHttpMethod: Text;
        IfMatch: Text;

    procedure FromFileInStream(var FileInStream: InStream)
    begin
        HttpContent.WriteFrom(FileInStream);
        ContentLength := GetContentLength(FileInStream);
    end;

    procedure FromJson(Object: JsonObject)
    var
        RequestText: Text;
    begin
        Object.WriteTo(RequestText);
        HttpContent.WriteFrom(RequestText);

        ContentLength := StrLen(RequestText);
        ContentType := 'application/json;odata=verbose';
    end;

    procedure GetContent(): HttpContent
    begin
        exit(HttpContent);
    end;

    procedure GetContentLength(): Integer
    begin
        exit(ContentLength);
    end;

    procedure GetContentType(): Text
    begin
        exit(ContentType);
    end;

    procedure SetRequestDigest(RequestDigestValue: Text)
    begin
        RequestDigest := RequestDigestValue;
    end;

    procedure GetRequestDigest(): Text;
    begin
        exit(RequestDigest);
    end;

    procedure SetXHttpMethod(XHttpMethodValue: Text)
    begin
        XHttpMethod := XHttpMethodValue;
    end;

    procedure GetXHttpMethod(): Text;
    begin
        exit(XHttpMethod);
    end;

    procedure SetIfMatch(IfMatchValue: Text)
    begin
        IfMatch := IfMatchValue;
    end;

    procedure GetIfMatch(): Text;
    begin
        exit(IfMatch);
    end;

    local procedure GetContentLength(var SourceInStream: InStream) Length: Integer
    var
        MemoryStream: DotNet MemoryStream;
    begin
        MemoryStream := MemoryStream.MemoryStream();
        CopyStream(MemoryStream, SourceInStream);
        Length := MemoryStream.Length;
        Clear(SourceInStream);
    end;

}

Procedures, 11

NameParametersReturnsAccessObsolete
FromFileInStream(var InStream)public-
FromJson(JsonObject)public-
GetContent()HttpContentpublic-
GetContentLength()Integerpublic-
GetContentType()Textpublic-
SetRequestDigest(Text)public-
GetRequestDigest()Textpublic-
SetXHttpMethod(Text)public-
GetXHttpMethod()Textpublic-
SetIfMatch(Text)public-
GetIfMatch()Textpublic-