1
votes

I heard Microsoft provides file handler add-in for custom (non-Microsoft) file types in Office 365.

I tried to do this following the tutorial found here, however it seems a bit outdated (although it was last updated in Jan 2017) because several things mentioned there are different from my environment - I use Visual Studio 2015 on Windows 10.

So basically here's what I'm trying to achieve. I have a custom file type with .encx extension, which is simply a encrypted docx file using our own cryptography algorithm. I can access to Office 365 tenant admin account. I want to allow our users to be able to open this encrypted file in OneDrive web interface.

Here's my environment:
Microsoft Visual Studio Enterprise 2015 Version 14.0.25123.00 Update 2
Microsoft .NET Framework Version 4.6.01586
Azure SDK v2.9.6

I created a new Visual C# project based on File Handler Application template in Office category from VS 2015.
And I added connected service for Office 365 API.
Since I have a free trial subscription on Azure account, I added all the required stuff like SQL database server, SQL db, Azure Active Directory - basically all the things explained in the above tutorial. And then I published and publishing was successful. I can see it live on the *.azurewebsites.net in my browser and sign in even works.

I used Addin manager sample Azure app as described in the tutorial to update add-in settings like file icon, preview/open/new endpoint link etc, and hit Update button. Now I uploaded some .encx files to OneDrive account but it still doesn't show custom icon nor open it in custom file handler (it just triggers browser file download).

I've been pulling my hair with this issue because I couldn't find any helpful/detailed answers anywhere online.

I seriously need help from Microsoft people.

UPDATE:

Now I have some progress - I can see custom file icon, .encx file now tries to show something as a preview when I select it, and opens in new tab if I click it.
The problem is Preview, Open works with my localhost URL, but not with published Azure web service URL. It says Sorry, something went wrong along with Invalid URL: |0..

Sorry, something went wrong - Invalid URL: |0.

UPDATE 2:

Here's a manifest file for Azure web service app:

{
  "appId": "0afc5455-a05b-4cc1-b241-89c717d9bce4",
  "appRoles": [],
  "availableToOtherTenants": false,
  "displayName": "MyFileHandler",
  "errorUrl": null,
  "groupMembershipClaims": null,
  "homepage": "http://my***.azurewebsites.net/",
  "identifierUris": [
    "https://filevisor.net/MyFileHandler"
  ],
  "keyCredentials": [],
  "knownClientApplications": [],
  "logoutUrl": null,
  "oauth2AllowImplicitFlow": false,
  "oauth2AllowUrlPathMatching": false,
  "oauth2Permissions": [
    {
      "adminConsentDescription": "Allow the application to access MyFileHandler on behalf of the signed-in user.",
      "adminConsentDisplayName": "Access MyFileHandler",
      "id": "5b21f973-edd5-4ace-a369-cfff0ed3b8fa",
      "isEnabled": true,
      "type": "User",
      "userConsentDescription": "Allow the application to access MyFileHandler on your behalf.",
      "userConsentDisplayName": "Access MyFileHandler",
      "value": "user_impersonation"
    }
  ],
  "oauth2RequirePostResponse": false,
  "passwordCredentials": [
    {
      "customKeyIdentifier": null,
      "endDate": "2018-02-02T05:22:35.7514025Z",
      "keyId": "b19de090-a661-402f-8ae2-624f148ff6fd",
      "startDate": "2017-02-02T05:22:35.7509019Z",
      "value": null
    }
  ],
  "publicClient": false,
  "replyUrls": [
    "http://my***.azurewebsites.net/"
  ],
  "requiredResourceAccess": [
    {
      "resourceAppId": "00000002-0000-0000-c000-000000000000",
      "resourceAccess": [
        {
          "id": "311a71cc-e848-46a1-bdf8-97ff7156d8e6",
          "type": "Scope"
        }
      ]
    },
    {
      "resourceAppId": "00000003-0000-0000-c000-000000000000",
      "resourceAccess": [
        {
          "id": "17dde5bd-8c17-420f-a486-969730c1b827",
          "type": "Scope"
        }
      ]
    }
  ],
  "samlMetadataUrl": null,
  "extensionProperties": [],
  "objectType": "Application",
  "objectId": "0bdea3fb-5ff7-4b8c-aa2c-6556a4c2ce46",
  "deletionTimestamp": null,
  "createdOnBehalfOf": null,
  "createdObjects": [],
  "manager": null,
  "directReports": [],
  "members": [],
  "memberOf": [],
  "owners": [],
  "ownedObjects": []
}
1
When you say it "doesn't ... open it in custom file handler", do you mean that the preview doesn't appear or that the file won't open in a custom editor? Also, can you use the Fiddler tool (telerik.com/fiddler) to see what POST request is sent (and what response is received) when you click the "..." link for the file? And also when you open the file for editing?Rick Kirkham
When I say "it doesn't open in custom file handler", I meant registered custom file extension is not recognized by OneDrive at all - icon does not change, it does not open file handler app in new tab, instead it triggers normal download just like regular unknown file type.elquimista
The icon now appeared when I tried on another computer - looks like cache issue?elquimista
@RickKirkham-Microsoft I have updated the question - what could be the possible reason?elquimista
I have to try to break this into 2 comments. I am finding it difficult to understand what is working and what is not working. You use the word "it" a lot and in many cases I can't tell what the "it" refers to. Could you please restate the question and replace the "it"s with specific nouns? Also, (1) Could you add your manifest to the question? The one you use when app is hosted on Azure. (You can disguise the domain.) (Rick Kirkham

1 Answers

0
votes

I don't see an "addIns" property in your manifest, as described here: Configure and update file handlers in Office 365. It might be that this property is just suppressed from the downloaded copy of the manifest, but if you haven't added this property to the manifest, please add it and see if that helps.