Publishing SharePoint apps that leverage SharePoint Workflow Services

Just a quick reference for those of you, who are developing SharePoint apps that leverage the SharePoint Workflow Services. If you are using Microsoft Visual Studio 2013, you can see the app publishing process has been improved and simplified. You simply right-click on the SharePoint app project, you select “Publish …”, and you are prompted with a nice and friendly page with all the buttons for managing your publishing phase.

image_thumb_2_32EAEBFD

Moreover, the publishing process is available whether you are publishing an app on the Office Store, or whether you are publishing the app on-premises on a Corporate Catalog.

image_thumb_32EAEBFD

Well, first of all by using this nice and friendly UI you can configure a publishing profile, providing information about the Client ID and Client Secret to use for publishing the app on Office 365 using OAuth, or you can provide the Client ID, the .PFX certificate file and password, and the Issuer ID if you plan to leverage a Server to Server deployment for on-premises farms.

You can deploy the web app directly to the target server (web deploy, web deploy package, FTP, file system).

image_thumb_3_32EAEBFD

Then, you can create the .APP package file for publishing the app to the target store (Office Store or Corporate Catalog) by clicking the “Package the app” button.

image_thumb_7_32EAEBFD

Notice that the “Package the app” wizard accepts only apps published via HTTPS. Thus, you will have to provide an SSL secured URL for your app, which is good and safe … but not always possible, for instance if you are packaging a test app and you do not want to use an SSL certificate. Keep in mind that in a production environment you should always use SSL!

Well, now if your app is leveraging one or more of the services available in SharePoint, those services will be listed in the AppManifest.xml file as Prerequisites. However, if you are using a workflow inside the app … the SharePoint Workflow Services requirement will make your app deployment to fail!

In fact, the AppManifest.xml generated by Visual Studio 2013 will reference a Capability with ID:

CDD8F991-B459-4512-8048-03D5A03FF27E

Here is a sample AppManifest.xml file generated by Visual Studio 2013:

< ?xml version="1.0" encoding="utf-8"?>
< App xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest" Name="NameOfYourApp" ProductID="{777fd9aa-cf34-4de3-bc86-e5d0c00b58bc}" Version="1.0.0.0" SharePointMinVersion="15.0.0.0">
< Properties>
< Title>Title of your App
< StartPage>https://host.domani.tld/?{StandardTokens}< /StartPage>
< SupportedLocales>
< SupportedLocale CultureName="en-US" />
< /SupportedLocales>
< /Properties>
< AppPrincipal>
< RemoteWebApplication ClientId="35f7958e-a9b3-44c0-86b1-cf363c716f90" />
< /AppPrincipal>
< AppPermissionRequests>
< AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
< /AppPermissionRequests>
< AppPrerequisites>
< AppPrerequisite Type="Capability" ID="CDD8F991-B459-4512-8048-03D5A03FF27E" />
< /AppPrerequisites>
< /App>

This is also documented here. However, as clearly stated by a comment in that article, the ID for the SharePoint Workflow Services is wrong. Meanwhile, the right ID is:

B1DDD88F-6ADD-4700-B5CD-18E451635E24

If you try to publish the app, let’s say in the Corporate Catalog, with the wrong ID in the AppManifest.xml file … the result will be something like that:

image_thumb_7_32EAEBFD

Moreover, by clicking on the “Find out why” link, you will see something like that:

image_thumb_6_32EAEBFD

A friendly message stating “Sorry, this app is not supported on your server.” will inform you that your target farm does not satisfy the declared requirements of your app. This could happen also if you reference a real requirement with a valid Capability ID, which is not available in the target farm. But in the case of SharePoint Workflow Services, the issue is related to the wrong Capability ID referenced in the AppManifest.xml file.

Well, to fix and solve the issue you simply need to edit the .APP file content, which under the cover is a .ZIP file. You can open it with WinZIP, WinRAR, or something like that. Then, you have to provide the proper Capability ID, which is B1DDD88F-6ADD-4700-B5CD-18E451635E24 and you are done! Upload the new and updated .APP file and enjoy your app!

I hope this will help.