OfficeDev / Outlook-Add-in-On-Send

Learn how to check for restricted words in an Outlook email message body, add a recipient to the CC line and check that there is a subject in the email on send.
MIT License
37 stars 32 forks source link

Error message with wrong child element when trying to define send event #2

Closed rickgoud closed 6 years ago

rickgoud commented 7 years ago

When I Try to add the OnSend Event definition in my manifest, I get an error message about a wrong child element. See attachment images. Searching for this error leads to no results. I tried to remove all other stuff but whatever I try to do, this message stays. I only have the suggested elements. Anyone any ideas? I use Visual Studio 2017

image

image

Thanks!

Regards, Rick

exextoc commented 7 years ago

Hi Rick, I just tried a new manifest in Visual Studio 2017 and that works for me. Could you copy and paste (or attach) your full manifest for us to try this out?

rickgoud commented 7 years ago

Hi exectoc,

When I use the full manifest of this example (Contoso Message Body Checker.xml) I get the same error message in VS 2017. Is there something special I need to include or something? Thanks!

exextoc commented 7 years ago

Thanks for reporting. This looks to be a issue with the schema checking for the manifest for VS2017. We will follow up. The sample manifest installs correctly to Exchange. As a temporary workaround, you can bypass VS2017 and installs the manifest directly. Or you can add a Hosts section (with VersionOverride 1.0 extension points) and that bypass the error in VS2017.

rickgoud commented 7 years ago

It indeed appear to be VS2017 related. Doesn't happen in VS 2015!

rickgoud commented 7 years ago

Arg, unfortunately it doesn't work in 2015 either. Appears to be caused by VS checking the sequence of the items in the XSD scheme. Any idea to fix this?

Placing the following code as the last element of the V1.0 override seems to work, but then the Extension Points defined in the V1.0 don't seem to work any more...ARG!

Can somebody try to make a VS-project out of this, please?

exextoc commented 7 years ago

@rickgoud I just created a VS-project and I can reproduce what you are seeing. If I add a random Description element, a Requirements element and a Hosts element, the XSD error disappears. Can you try that? So my manifest looks like this:

<VersionOverrides xmlns=".../office/mailappversionoverrides" xsi:type="VersionOverridesV1_0">

    <!-- workaround starts here -->
    <Description resid="residAppDescription" />
    <Requirements>
        <bt:Sets DefaultMinVersion="1.3">
            <bt:Set Name="Mailbox" />
        </bt:Sets>
    </Requirements>
    <Hosts>
        <Host xsi:type="MailHost"></Host>
    </Hosts>
    <!-- workaround ends here -->

    <VersionOverrides xmlns=".../office/mailappversionoverrides/1.1" xsi:type="VersionOverridesV1_1">
        <Requirements>
            <bt:Sets DefaultMinVersion="1.3">
                <bt:Set Name="Mailbox" />
            </bt:Sets>
        </Requirements>
        <Hosts>
            <Host xsi:type="MailHost">
                <DesktopFormFactor>
                    <!-- Location of the Functions that UI-less buttons can trigger (ExecuteFunction Actions). -->
                    <FunctionFile resid="functionFile" />
                </DesktopFormFactor>
            </Host>
        </Hosts>
    </VersionOverrides>

    <Resources>
        <bt:LongStrings>
            <bt:String id="residAppDescription" DefaultValue="Foo Description"></bt:String>
        </bt:LongStrings>
    </Resources>
</VersionOverrides>
tarunchopra commented 7 years ago

Upgrade to Vs 2017 preview bits and it should help in resolving the issue. At least it helped in my contextual add-in project - https://www.visualstudio.com/vs/preview/

tarunchopra commented 7 years ago

To add; you need Visual Studio 2017 Version 15.3 (26424.2-Preview) or later to get rid of this error.

rickgoud commented 7 years ago

Argh. With VS 2017 preview (15.3 25610.0) for me the error has shifted to the extension point (see image); and in the preciew the solution of you @exextoc als does not work :(. Any more suggestions? Thanks!

image

tarunchopra commented 7 years ago

@rickgoud - Are you able to import this manifest in 0365 directly through OWA ? I'll try my solution but it will take sometime; I would say open the project with VS code and directly import the manifest to your o365 owa. If OWA is accepting it then its fine.

tarunchopra commented 7 years ago

@rickgoud : I verified that the manifests are getting installed by OWA successfully. As there is no .sln file with the project, i'd say just use npm instead of VS. I agree that it should work with VS too, but i'm just suggesting a workaround here to unblock you and here are the steps:-

  1. Install npm.
  2. Go to following directory master/outlook-add-in-on-send on your local drive.
  3. Open npm command prompt and issue command - 'npm install'
  4. Then execute command 'npm start'.
  5. Now your add-in is running.
  6. Import manifest file to your OWA and you are good to go.

Thanks

jasonjoh commented 7 years ago

Visual Studio's schema hasn't been updated for this new type, which is why you're seeing that error. The add-in itself should still work. The VS team is working on getting the updated schema.

rickgoud commented 7 years ago

Works like a charm guys! Thanks! Any idea when this will be available for Outlook Mac/Windows as well? And will is also be later on be publishable in store?

exextoc commented 7 years ago

Glad to hear it worked! 👍 Unfortunately we don't have a timeline to share at this time.

grg17 commented 7 years ago

I'm new to Outlook add-in development, so sorry for stupid questions. I cannot make the add-in to work. Here is what I did:

  1. Created a webapp in Azure (https://outlookhost.azurewebsites.net) and uploaded app.js and index.html
  2. Updated manifest files to point to Azure website index.html.
  3. Enabled add-ins in Outlook.live.com account by uploading manifests (attached).

However, nothing happens when I try to send a new email without specifying subject. Am I missing something? Is it possible to debug the add-in?

Regarding the above instructions by tarunchopra. Could someone explain me how it can work with localhost server which is started by 'npm start'? Shouldn't the manifest be pointing to public URI and not localhost?

Thank you very much in advance! And once again sorry for trivial questions.

Contoso Subject and CC Checker.txt Renamed to .txt. Contoso Message Body Checker.txt Renamed to .txt.

tarunchopra commented 7 years ago

In owa; being up the addin and use f12 to debug it like any other webapp. For npm; manifest can point to local host. There are lots of sample out there to help you; search at dev.office.com. If you are still blocked; drop me an email with your code and ill try to help.

exextoc commented 7 years ago

@Gigo314, you can debug the add-in, however in addition to enabling the add-in, the "on send add-ins" feature must be enabled on a mailbox before it will run. It's usually enabled by an organization administrator and isn't available for outlook.com accounts. Please see this page for information on how to enable this feature: https://docs.microsoft.com/en-us/outlook/add-ins/outlook-on-send-addins#enabling-the-on-send-feature

If you don't have an Office 365 account to test with, you can get one through the Office 365 Developer Program here: https://dev.office.com/devprogram

piwinux commented 6 years ago

Hello, I am using Visual Studio Enterprise 2017 15.5.2, and I am also getting the error This is an invalid xsi:type 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1:Events'. Any idea when will this bug be fixed? And is there a workaround to fix the problem the meantime? Thanks!

ElizabethSamuel-MSFT commented 6 years ago

@piwinux Are you still facing this issue? Please open a new issue if that's the case. Thanks.

laurence73 commented 6 years ago

Just to confirm this is still an issue. VS2017 15.8.5

This is an invalid xsi:type 'http://schemas.microsoft.com/office/mailappversionoverrides/1.1:Events'

N-HaZ3 commented 6 years ago

Just to confirm this is still an issue. VS2017 15.8.6

invalid type

I am running my addin with 'npm install' and it worked. Importing my manifest file to my OWA worked, too. Anyway no function i declare is running...

Any ideas?

chrisrobertsoncypress commented 5 years ago

Still an issue with VS 2017 Community 15.9.3 on Dec 10, 2018.

chrisrobertsoncypress commented 5 years ago

According to jasonjoh's remark, the VS team has been working on getting an updated schema for a year and a half? That's a long time to work on something.

It makes me think that Microsoft is not concerned about O365 development.

jburkhalter-afas commented 5 years ago

STILL DOESN'T WORK!!!

exextoc commented 5 years ago

The schema should be up to date in Visual Studio 2019. There is a work around for developing ItemSend Event add-ins for Outlook in Visual Studio 2017 here.

jburkhalter-afas commented 5 years ago

Thank you exextoc!

ZameelAmjed commented 2 years ago

Issue is still present on Microsoft Visual Studio Community 2022 (64-bit) - Version 17.2.6