web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :

Base64 encoder/decoder

h-nagao Profile Picture Posted by h-nagao 392

This app allows you to encode plain text to base64, and decode base64 to text.

Detail of technique is described in my blog post 

 

https://mofumofupower.hatenablog.com/entry/encode_decode

 

Categories:

Comments

  • DDM Profile Picture DDM 79
    Posted at
    Base64 encoder/decoder

    Again, can I please ask that you mark my original response as the solution.

     

    DDM_0-1720091832405.png

     

     

    This will help others who need to find a solution to this issue.

     

    Yes this is solvable but will need Site Collection Admin rights on the site and an understanding of how search works in SharePoint 

     

    Manage the search schema in SharePoint - SharePoint in Microsoft 365 | Microsoft Learn

     

    DDM_0-1720091273048.png

    DDM_1-1720091327161.png

     

     

  • PKD360 Profile Picture PKD360
    Posted at
    Base64 encoder/decoder

    So , is that issue solvable ? I am New to this ...That's why so many doubts

     

  • DDM Profile Picture DDM 79
    Posted at
    Base64 encoder/decoder

    Then please mark as answer.

     

    As i say, the issue you now currently face is no longer with GraphAPI or PowerApps.

     

    It is purely an issue with SharePoint Managed and Crawled properties.

     

    DDM

  • PKD360 Profile Picture PKD360
    Posted at
    Base64 encoder/decoder

    The Answer You provided is working with some changes like my share point link . But when I am trying to get my List column name result like 

    PKD360_0-1720084370119.png

    Then I am not getting any response for those 

  • DDM Profile Picture DDM 79
    Posted at
    Base64 encoder/decoder

    Did the original response solve your issue ? If so please mark as answer.

     

    Results not showing ? I assume you mean in the search results ? You can test in PowerApps monitor and check the response output. In my experience, it is almost always down to SharePoint Search (Managed and Crawled Properties).

     

    DDM

  • PKD360 Profile Picture PKD360
    Posted at
    Base64 encoder/decoder

    When I have Columns Like:- Id Product Sales Person Quantity Discount Unit Price Age Region Category Profit Margin

    if I am putting these inside  ""fields"": [  ] noting is return in response only title i am getting and ""id"", ""listId"", ""author"", ""title"", ""JobNo"" are getting ..my column name results are not showing

    PKD360_0-1720083871913.png

     

  • DDM Profile Picture DDM 79
    Posted at
    Base64 encoder/decoder

    Here is my solution:

     

    Set(varRequestBody,"{
        ""requests"": [{
            ""entityTypes"": [
                ""listItem""
            ],
            ""query"": {
                ""queryString"": ""*"& txtSearch.Text &"* path:\""https://xxxxxx.sharepoint.com/sites/XXXX/Lists/XXXXX\""""
            },
            ""sortProperties"": [{
                ""name"": ""createdDateTime"",
                ""isDescending"": ""true""
            }],
            ""size"": "& ddPaginationSize.Selected.Value &",
            ""from"":"& varFrom &",
            ""fields"": [
                ""title"",
                ""ListItemId"",
                ""Filename"",
                ""WebUrl"",
                ""SiteID"",
                ""Language"",
                ""Country""
            ]
        }]
    }");
    Set(varFile,
        "data:text/plain;base64," & With({
        InputText:varRequestBody,
        AsciiTable:AddColumns(Sequence(255,1),char,Char(Value)),
        B64ToBin:
        Table(
            {b64:"A",bin:"000000"},
            {b64:"B",bin:"000001"},
            {b64:"C",bin:"000010"},
            {b64:"D",bin:"000011"},
            {b64:"E",bin:"000100"},
            {b64:"F",bin:"000101"},
            {b64:"G",bin:"000110"},
            {b64:"H",bin:"000111"},
            {b64:"I",bin:"001000"},
            {b64:"J",bin:"001001"},
            {b64:"K",bin:"001010"},
            {b64:"L",bin:"001011"},
            {b64:"M",bin:"001100"},
            {b64:"N",bin:"001101"},
            {b64:"O",bin:"001110"},
            {b64:"P",bin:"001111"},
            {b64:"Q",bin:"010000"},
            {b64:"R",bin:"010001"},
            {b64:"S",bin:"010010"},
            {b64:"T",bin:"010011"},
            {b64:"U",bin:"010100"},
            {b64:"V",bin:"010101"},
            {b64:"W",bin:"010110"},
            {b64:"X",bin:"010111"},
            {b64:"Y",bin:"011000"},
            {b64:"Z",bin:"011001"},
            {b64:"a",bin:"011010"},
            {b64:"b",bin:"011011"},
            {b64:"c",bin:"011100"},
            {b64:"d",bin:"011101"},
            {b64:"e",bin:"011110"},
            {b64:"f",bin:"011111"},
            {b64:"g",bin:"100000"},
            {b64:"h",bin:"100001"},
            {b64:"i",bin:"100010"},
            {b64:"j",bin:"100011"},
            {b64:"k",bin:"100100"},
            {b64:"l",bin:"100101"},
            {b64:"m",bin:"100110"},
            {b64:"n",bin:"100111"},
            {b64:"o",bin:"101000"},
            {b64:"p",bin:"101001"},
            {b64:"q",bin:"101010"},
            {b64:"r",bin:"101011"},
            {b64:"s",bin:"101100"},
            {b64:"t",bin:"101101"},
            {b64:"u",bin:"101110"},
            {b64:"v",bin:"101111"},
            {b64:"w",bin:"110000"},
            {b64:"x",bin:"110001"},
            {b64:"y",bin:"110010"},
            {b64:"z",bin:"110011"},
            {b64:"0",bin:"110100"},
            {b64:"1",bin:"110101"},
            {b64:"2",bin:"110110"},
            {b64:"3",bin:"110111"},
            {b64:"4",bin:"111000"},
            {b64:"5",bin:"111001"},
            {b64:"6",bin:"111010"},
            {b64:"7",bin:"111011"},
            {b64:"8",bin:"111100"},
            {b64:"9",bin:"111101"},
            {b64:"+",bin:"111110"},
            {b64:"/",bin:"111111"}
        )},
        With({
        BinRep:
        Concat(
            AddColumns(ForAll(Split(InputText,""), {Result: ThisRecord.Value}),dec,LookUp(AsciiTable,char=Result).Value)
            ,//Convert text to Ascii character code (decimal)
            Concat(Sequence(8,8,-1),Text(If(And(Mod(dec,Power(2,Value))>=Power(2,Value-1),Mod(dec,Power(2,Value))<Power(2,Value)),1,0)))&"","")//Convert decimal to binary
        },
            With({b64string:Concat(
                Sequence(
                    RoundUp(Len(BinRep)/6,0),0),
                    LookUp(
                        B64ToBin,
                        bin=Mid(BinRep&Left("000000",6-Mod(Len(BinRep),6)),6*Value+1,6) //Left("000000"....) is padding right with zero
                    ).b64&"",
                    ""
                )},
                b64string&Left("====",Mod(4-Mod(Len(b64string),4),4))//Convert binary to base64
            )
        )
    )
    );

    Set(SearchResults,Office365Groups.HttpRequest("https://graph.microsoft.com/v1.0/search/query","POST",varFile));
  • PKD360 Profile Picture PKD360
    Posted at
    Base64 encoder/decoder

    Is it fixed bro because I have tried same but getting error

    1.

    PKD360_0-1720010069827.png

    2.

    PKD360_1-1720010122087.png

     

  • DDM Profile Picture DDM 79
    Posted at
    Base64 encoder/decoder

    There is a discrepancy between what is in the demo app and what is in your blog post.

    Encode/Decode Base64 in Power Apps without Flow - MoreBeerMorePower (hatenablog.com)

     

    These appear to be cause an error in my app.  The code in the app works in your app but when i change it to code in your blog it throws an error

     

    DDM_0-1716146858115.png

     

    DDM_0-1716203692957.png

     

     

    Blog :

    AsciiTable:AddColumns(Sequence(2^8,1),"char",Char(Value)

    AddColumns(ForAll(Split(InputText,""), {Result: ThisRecord.Value}),"dec",LookUp(AsciiTable,char=Result).Value),//Convert text to Ascii character code (decimal)

     

    App: 

    AsciiTable:AddColumns(Sequence(2^8,1),char,Char(Value)),

    AddColumns(ForAll(Split(InputText,""), {Result: ThisRecord.Value}),dec,LookUp(AsciiTable,char=Result).Value),//Convert text to Ascii character code (decimal)

     

    I face the same error when trying to use the code from the blog in another app I am developing.  When using the code from the demo app, it does not return an error but causes my HttpRequest to fail but the code from your blog throws the error shown above in the screenshot.

     

    Can you help please ?

    Thanks

  • TimVW Profile Picture TimVW 2
    Posted at
    Base64 encoder/decoder
    By changing the Sequence start from 0 to 1 the error will no longer occur.
    The Char-function only allows input value 1 to 255, and in the original it will try Char(0) as the sequence was set up to start from 0.
     
    AsciiTable:AddColumns(Sequence(2^8,1),char,Char(Value))