cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Frequent Visitor

Injecting updated JSON into msapp without error

I am attempting to:

  • unpackage an exported .msaap file,
  • edit the "2.json" file (the content of the app itself) in the "Controls" folder (I find and replace of a lot of variables),
  • and then repackage the .msaap and upload it.

 

This doesn't work.  The app will open, but the canvas is blank.

 

Re-exporting the broken app and examining the .msaap file shows that the "2.json" file is now missing but the other files are just fine, as if the "2.json" files was stripped out during the upload/opening process in the PowerApps web interface.

 

In an attempt to solve the problem, I modifed file attribute flags in the .msaap file (which is just a .zip file), such as the "A" archive bit, and the Created and Accessed attributes.  The same error resulted.

 

Does anyone know how to edit the "2.json" file and successfully repackage to a working app?

 

It would save me literally dozens of hours...

 

-James

15 REPLIES 15
Anonymous
Not applicable

@JamesA , sorry to hear that did not work for you.  

I haven't yet tried to edit any of the files and place them back in the zip/msapp, so perhaps this wouldn't work for me either.  In the past this was simple.

 

In actuality it is a shame that we even NEED to do this since PowerApps messes up code so badly it puts your app in these states.  

 

As mentioned earlier, I had to ENTIRELY rebuild my app from scratch (meaning create new app and then cut/paste, and modify everything in it from an older app) in order to get things to work.  Most of the Width and X values (especially) and many of the Y and Height values for MOST of the controls were wiped out when importing components as well as cutting and pasting the controls between apps (or even within the same app).  These appear to be NEW bugs (or at least MUCH worse than in the past).

 

And code continually being automatically changed (formulas wiped out, even some static values changed at times, sometimes collection property accesses replaced with garbage, etc) is ridiculous.

 

Spent FOUR HOURS last night trying to recover from this type of stuff in order to otherwise fix a problem (mine) that should have taken 10 minutes.

 

 

 

It's a big issue and it makes powerapps very frustrating to work within.  


@Anonymous  and @JamesA ,

 

Thanks so much for your efforts on this.  Two questions....since it's been a few months:

 

1) Have you had any success in getting direct-edits inside MSAPP files to be returneable to PApps and get a functioning app since July?

 

2) BrianR, you mentioned the muckups the PApps Studio does to existing/working formulas. 

 

"And code continually being automatically changed (formulas wiped out, even some static values changed at times, sometimes collection property accesses replaced with garbage, etc) is ridiculous."

I found this thread while looking to see if I was going crazy or if the Studio WAS wiping out stuff I coulda sworn I'd put it/changed. 

 

Are you aware of any official "issue" for this batty behavior having been raised with MSFT?

     

What I'm seeing far too often is I make a change to an existing formula (though I cannot be sure that that includes just creating a formula to replace the existing default) and click over to some other property or control.  When I come back to the original property's formula, it's reverted to an earlier version....as if I never put my newer one there.  WTF!!

 

On a less important note:  VS Code is the "protective gear" one has to use when doing PApps (Studio), don't ya think? 🙂  Thank GOD for VS Code and Notepad++.....oh, and the ability to unzip MSAPPs so I can find stuff that is IMPOSSSIBLE to locate via Studio.

msapp modifications does not work.

1. Download package (let's call it app.zip)

2. Unzip to another folder

3. Go to msapp file (let's call it N4d1dec0a-7dfc-41d3-a346-b61020c26449-document.msapp )

4. Unzip to another folder

5. Modify one existing label in file /Controls/1.json, for ex:

{
                "Type": "ControlInfo",
                "Name": "DataCardKey13",
                "Template": {
                  "Id": "http://microsoft.com/appmagic/label",
                  "Version": "2.3.0",
                  "LastModifiedTimestamp": "0",
                  "Name": "label",
                  "FirstParty": true,
                  "IsCustomGroupControlTemplate": false,
                  "CustomGroupControlTemplateName": "",
                  "IsComponentDefinition": false,
                  "OverridableProperties": {}
                },
                "Index": 0.0,
                "PublishOrderIndex": 40,
                "VariantName": "",
                "LayoutName": "horizontal",
                "MetaDataIDKey": "%FieldName.ID%",
                "PersistMetaDataIDKey": false,
                "IsFromScreenLayout": false,
                "StyleName": "accentLabelStyle",
                "Parent": "ProjectName_DataCard1",
                "IsDataControl": false,
                "IsGroupControl": false,
                "IsAutoGenerated": false,
                "Rules": [
                  {
                    "Property": "Live",
                    "Category": "Data",
                    "InvariantScript": "Live.Off"
                  },
                  {
                    "Property": "Role",
                    "Category": "Data",
                    "InvariantScript": "TextRole.Default"
                  },
                  {
                    "Property": "Text",
                    "Category": "Data",
                    "InvariantScript": "\"Nom de 123 l'affaire\""
                  },

I've added 123 in the middle of string.

 

6. Copy this file 1.json to the msapp archive file (use Total Commander, for example)

7. Copy msapp file (N4d1dec0a-7dfc-41d3-a346-b61020c26449-document.msapp) to the previously downloaded app (app.zip)

8. Upload the app back - no errors, all fine.

9. Open the app for edit - WHOLE PAGE DISAPPEARED!

 

 

 

 

 

I can confirm the test from the last post. No modifications are possible. Wanted to do mass updates for a changing data source, but instead the whole page gets wiped 😞

Very sad about it. Use case is, customer has created app with over 1600 columns. As you might expect it is super slow and I want to change it to SharePoint while doing mass updates. But even with a small singe application it is not possible.

Still an issue as of October 2020. Trying to inject updated json files back to msapp file after updating reference to different SharePoint list as part of promoting the app from dev to prod environment. Anyone have a work around?

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Kudoed Authors
Users online (3,648)