author | ms.assetid | description | title | ms.author | ms.date | ms.topic | ms.prod | ms.technology | keywords | ms.localizationpriority |
---|---|---|---|---|---|---|---|---|---|---|
mcleanbyron |
FABA802F-9CB2-4894-9848-9BB040F9851F |
Use the C# code examples in this section to learn more about using the Microsoft Store submission API. |
C# sample - submissions for apps, add-ons, and flights |
mcleans |
08/03/2017 |
article |
windows |
uwp |
windows 10, uwp, Microsoft Store submission API, code examples, C# |
medium |
This article provides C# code examples that demonstrate how to use the Microsoft Store submission API for these tasks:
- Create an app submission
- Create an add-on submission
- Update an add-on submission
- Create a package flight submission
You can review each example to learn more about the task it demonstrates, or you can build all the code examples in this article into a console application. To build the examples, create a C# console application named DeveloperApiCSharpSample in Visual Studio, copy each example to a separate code file in the project, and build the project.
These examples use the following libraries:
- Microsoft.WindowsAzure.Storage.dll. This library is available in the Azure SDK for .NET, or you can obtain it by installing the WindowsAzure.Storage NuGet package.
- Newtonsoft.Json NuGet package from Newtonsoft.
The following example implements a command line program that calls the other example methods in this article to demonstrate different ways to use the Microsoft Store submission API. To adapt this program for your own use:
- Assign the
ApplicationId
,InAppProductId
, andFlightId
properties to the ID of the app, add-on, and package flight you want to manage. - Assign the
ClientId
andClientSecret
properties to the client ID and key for your app, and replace the tenantid string in theTokenEndpoint
URL with the tenant ID for your app. For more information, see How to associate an Azure AD application with your Windows Dev Center account
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]
The sample app uses the ClientConfiguration
helper class to pass Azure Active Directory data and app data to each of the example methods that use the Microsoft Store submission API.
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]
The following example implements a class that uses several methods in the Microsoft Store submission API to update an app submission. The RunAppSubmissionUpdateSample
method in the class creates a new submission as a clone of the last published submission, and then it updates and commits the cloned submission to Windows Dev Center. Specifically, the RunAppSubmissionUpdateSample
method performs these tasks:
- To begin, the method gets data for the specified app.
- Next, it deletes the pending submission for the app, if one exists.
- It then creates a new submission for the app (the new submission is a copy of the last published submission).
- It changes some details for the new submission and upload a new package for the submission to Azure Blob storage.
- Next, it updates and then commits the new submission to Windows Dev Center.
- Finally, it periodically checks the status of the new submission until the submission is successfully committed.
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]
The following example implements a class that uses several methods in the Microsoft Store submission API to create a new add-on submission. The RunInAppProductSubmissionCreateSample
method in the class performs these tasks:
- To begin, the method creates a new add-on.
- Next, it creates a new submission for the add-on.
- It uploads a ZIP archive that contains icons for the submission to Azure Blob storage.
- Next, it commits the new submission to Windows Dev Center.
- Finally, it periodically checks the status of the new submission until the submission is successfully committed.
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]
The following example implements a class that uses several methods in the Microsoft Store submission API to update an existing add-on submission. The RunInAppProductSubmissionUpdateSample
method in the class creates a new submission as a clone of the last published submission, and then it updates and commits the cloned submission to Windows Dev Center. Specifically, the RunInAppProductSubmissionUpdateSample
method performs these tasks:
- To begin, the method gets data for the specified add-on.
- Next, it deletes the pending submission for the add-on, if one exists.
- It then creates a new submission for the add-on (the new submission is a copy of the last published submission).
- Next, it updates and then commits the new submission to Windows Dev Center.
- Finally, it periodically checks the status of the new submission until the submission is successfully committed.
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]
The following example implements a class that uses several methods in the Microsoft Store submission API to update a package flight submission. The RunFlightSubmissionUpdateSample
method in the class creates a new submission as a clone of the last published submission, and then it updates and commits the cloned submission to Windows Dev Center. Specifically, the RunFlightSubmissionUpdateSample
method performs these tasks:
- To begin, the method gets data for the specified package flight.
- Next, it deletes the pending submission for the package flight, if one exists.
- It then creates a new submission for the package flight (the new submission is a copy of the last published submission).
- It uploads a new package for the submission to Azure Blob storage.
- Next, it updates and then commits the new submission to Windows Dev Center.
- Finally, it periodically checks the status of the new submission until the submission is successfully committed.
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]
The IngestionClient
class provides helper methods that are used by other methods in the sample app to perform the following tasks:
- Obtain an Azure AD access token that can be used to call methods in the Microsoft Store submission API. After you obtain a token, you have 60 minutes to use this token in calls to the Microsoft Store submission API before the token expires. After the token expires, you can generate a new token.
- Upload a ZIP archive containing new assets for an app or add-on submission to Azure Blob storage. For more information about uploading a ZIP archive to Azure Blob storage for app and add-on submissions, see the relevant instructions in Create an app submission and Create an add-on submission.
- Process the HTTP requests for the Microsoft Store submission API.
[!div class="tabbedCodeSnippets"] [!code-csSubmissionApi]