-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added new command Export-PnPPowerApp #2990
Conversation
resources = wrapper.Resources | ||
}; | ||
|
||
var responseHeader = RestHelper.PostAsyncGetResponseHeader<string>(Connection.HttpClient, $"https://api.bap.microsoft.com/providers/Microsoft.BusinessAppPlatform/environments/{environmentName}/exportPackage?api-version=2016-11-01", AccessToken, payload: exportPostData).GetAwaiter().GetResult(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gautamdsheth @KoenZomers
To Export a PowerApp Package we need to make multiple API Calls, and this is 2nd call /exportpackage which returns us the location of another URL which will tell us when the download is ready but we have to keep of sending request.... and then when the status is successed it would return the url of zip file. Now the location property from this API call comes in response Headers and not as a response content so I had to introduce new functions in RestHelper which will return us headers to read the response headers properties.
So if you check in RestHelper, I have added two new functions...open to suggestions on the best way to handle this?
@@ -633,6 +649,28 @@ private static async Task<string> SendMessageAsync(HttpClient httpClient, HttpRe | |||
} | |||
} | |||
|
|||
private static async Task<HttpResponseHeaders> SendMessageAsyncGetResponseHeader(HttpClient httpClient, HttpRequestMessage message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New method to make API Call but return Response Headers rather than content
@@ -289,6 +289,22 @@ public static async Task<T> PostAsync<T>(HttpClient httpClient, string url, stri | |||
return default(T); | |||
} | |||
|
|||
public static async Task<HttpResponseHeaders> PostAsyncGetResponseHeader<T>(HttpClient httpClient, string url, string accessToken, object payload, bool camlCasePolicy = true, string accept = "application/json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Base method which is being called from actuall command.cs file.
Can you please move the logic to a separate file or create one like Also, can you please rename the method as About the method names, am still thinking on how to reduce duplicate code, will get back to you on that |
Hi @gautamdsheth - sorry was not able get to this sooner... I have updated as per review comments. please check now? |
Thanks @siddharth-vaghasia , merged this, amazing stuff ! Much appreciated 😊🙏 |
hi @gautamdsheth - do let me know when it would be available for testing? I will test it once :) |
@siddharth-vaghasia Should be in the current nightly build. Every night at 2.30 AM CET a nightly build gets created which contains the latest code thus far. |
Hi @KoenZomers, @siddharth-vaghasia. Hope you are doing well! |
hi @LucX4 - can you please the PnP PowerShell version you are using? |
It's 1.12.0: |
@siddharth-vaghasia, |
Type
Related Issues?
NA
What is in this Pull Request ?
Added new command Export-PnPPowerApp which will export a specified PowerApp as zip package, this command would be useful to automate the backup of the PowerApp/s or to automate the deployment in DevOps
Note - @gautamdsheth @KoenZomers - I would need your advise/feedback specifically on one thing... so adding some comments in PR for your comment.