Microsoft Azure offers a powerful platform for hosting and deploying Office Add-ins, allowing developers to create dynamic and interactive experiences within Microsoft Word and other Office applications. In this article, we will explore the process of deploying an Office Add-in web app to Azure and sideloading it for testing in Microsoft Word.
Prerequisites
Before we begin, let's ensure we have all the necessary prerequisites in place:
Install Visual Studio 2019 with the Azure development workload. This will provide the necessary tools for developing and deploying Azure web apps.
Install Microsoft Office on your development computer. This will allow us to test the add-in within the Office client applications.
Obtain an Azure subscription. You will need a valid Azure subscription to create and host the web app for your Office Add-in.
Step 1: Create a Shared Folder
To deploy an Office Add-in to Azure, we first need to create a shared folder where we can store the add-in XML manifest file. This file describes the characteristics of the add-in, such as its name and the URL for the add-in's HTML page.
Open File Explorer on your development computer.
Right-click the C:\ drive and choose New > Folder.
Name the new folder "AddinManifests".
Right-click the AddinManifests folder and choose Share with > Specific people.
In the File Sharing dialog, choose the drop-down arrow and select "Everyone > Add > Share".
Step 2: Configure Trusted Add-in Catalog
To allow Word to load the add-in from our shared folder, we need to configure it as a trusted add-in catalog.
Open Word and create a new document.
Choose File > Options.
In the Word Options dialog, select "Trust Center" and then "Trust Center Settings".
In the Trust Center dialog, choose "Trusted Add-in Catalogs".
Enter the UNC path for the shared folder you created earlier (e.g., \\YourMachineName\AddinManifests) as the Catalog URL and choose "Add catalog".
Select the checkbox for "Show in Menu".
Step 3: Create a Web App in Azure
Now that we have our prerequisites set up, let's create a web app in Azure to host our Office Add-in.
Log on to the Azure portal using your Azure credentials.
Under Azure Services, select "Web Apps".
On the App Service page, select "Add" to create a new web app.
Provide the necessary information, such as subscription, resource group, app name, runtime stack, OS, region, and App Service plan.
Choose "Create" to create the web app.
Wait for the deployment to complete, and then select "Go to resource" to open the web app.
In the Overview section, note the URL displayed under "URL". This is the root URL of your Azure web app.
It is strongly recommended to use an HTTPS endpoint for your add-in. You can obtain an SSL certificate or use a self-signed certificate for development and testing purposes.
Step 4: Create an Office Add-in in Visual Studio
With our web app set up, let's create a basic Office Add-in project in Visual Studio.
Open Visual Studio as an administrator.
Choose "Create a new project" and search for "add-in".
Select "Word Web Add-in" as the project type and choose "Next" to accept the default settings.
Visual Studio will create a basic Word add-in project that we can publish to Azure.
Step 5: Publish the Office Add-in Web App to Azure
Now, let's publish our Office Add-in web app to Azure.
With your add-in project open in Visual Studio, expand the solution node in Solution Explorer and select the web project.
Right-click the web project and choose "Publish".
On the Publish tab, select "Microsoft Azure App Service" and choose "Select Existing".
Choose "Publish" to publish the web project to your Azure web app.
After the publishing process is complete, your browser will open and display a webpage with the text "Your App Service app has been created".
Copy the root URL of your Azure web app (e.g., https://YourDomain.azurewebsites.net). We will need this URL to edit the add-in manifest file.
Step 6: Edit and Deploy the Add-in XML Manifest File
To connect our Office Add-in to the Azure web app, we need to edit the add-in XML manifest file.
In Visual Studio, expand the solution and open the add-in XML manifest file.
Replace all instances of "~remoteAppUrl" with the root URL of your add-in web app on Azure (e.g., https://YourDomain.azurewebsites.net).
Save the manifest file.
Using the File Explorer, navigate to the shared folder created in Step 1 and paste the manifest file into the folder.
Step 7: Sideloading the Add-in in Microsoft Word
Finally, let's sideload the add-in in Microsoft Word for testing.
Open Word and create a new document.
Select "Home" > "Add-ins" and choose "Get Add-ins".
In the Office Add-ins dialog, choose "SHARED FOLDER". Word will scan the trusted add-ins catalog and display the add-ins available in the shared folder.
Choose the icon for your add-in and select "Add". A "Show Taskpane" button for your add-in will be added to the ribbon.
On the ribbon, select the "Show Taskpane" button. The add-in will open in a task pane to the right of the document.
Verify that the add-in is functioning correctly by selecting some text in the document and choosing the available options in the task pane.
Deploying Updates
When you need to deploy updates to your Office Add-in, there are a few considerations to keep in mind.
If your add-in is deployed by admins to their organizations, certain manifest changes will require admin consent before users can access the updated version.
Changes to requested permissions, scopes, or Outlook events may require admin consent.
Whenever you make changes to the manifest, remember to raise the version number to ensure the updated add-in is recognized.
Conclusion
Deploying and testing Office Add-ins on Microsoft Azure provides developers with a robust platform for creating rich and interactive experiences within Microsoft Word and other Office applications. By following the steps outlined in this article, you can easily deploy your add-in to Azure and sideload it for testing in Microsoft Word. Get started today and unlock the full potential of Microsoft Azure for your Office Add-ins.
Check out:
The Ultimate Guide to Creating Shapes for Word Clouds for Free
How to Create Word Maps Online: A Comprehensive Guide
Random Drawing Generator Wheel
Không có nhận xét nào:
Đăng nhận xét