I am trying to connect to an API (Microsoft Graph connection to OneNote with app registration via Azure, appropriate rights etc) that (for my use case) expects one xhtml file (Presentation part, the page posted to onenote)
application/xhtml+xml
and a picture (card part, a picture for extract.businesscard) as part of a
multipart/form-data
POST request.
I already built a custom connector with a swagger (OpenAPI 2) file but cannot successfully feed the xhtml/Presentation part.
I need to do it this way because extract.businesscard only seems to work for these multipart requests.
Sending just the html with the image embedded as base64 image does not generate the extracted business card section with embedded vcf.
My flow (simplified and abridged) consists of a
http-Request
trigger followed by my custom connector which gets passed, expecting first the picture, then the xhtml
card: triggerMultipartBody(0)
Presentation: triggerMultipartBody(1)

I don't know what
card (file name), Presentation (file name)
are supposed to do.
Testing the flow with postman (posting to the http-Request trigger url), the flow basically works, but the Content-Type of the xhtml/Presentation part of the multipart/form-data request seems to get messed up.


Directly using postman to test the API that the custom connector is built for works.

I also tried using an exported Postman v1 of this Postman request.
This generates a connector with a strange key/value-something (json?) trigger() that I can't feed at all from flow.
- Is my problem because of my custom connector/swagger (swagger file at end of this post)?
As far as I've read (and tested), OpenAPI 3 allows Content-Type declarations for multipart-formdata requests, but OpenAPI 3 is not supported by Custom Connectors.
Is there a microsoft vendor extension for the swagger/OpenAPI 2 to enforce Content-Type for multipart-formdata? - Or do I need to change the flow?
- Or do something with "file name"?
PS: my swagger file for the custom connector, the /me get action is just for authentification testing purposes.
The /me/onenote/pages post action causes my issues.
{
"info": {
"title": "Graph OneNote",
"description": "Access OneNote via Graph API",
"version": "1.0.1"
},
"paths": {
"/v1.0/me": {
"get": {
"summary": "Get me",
"operationId": "GetMe",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object",
"properties": {
"@odata.context": {
"type": "string"
},
"id": {
"type": "string"
},
"businessPhones": {
"type": "array",
"items": {
"type": "string"
}
},
"displayName": {
"type": "string"
},
"givenName": {
"type": "string"
},
"jobTitle": {
"type": "string"
},
"mail": {
"type": "string"
},
"mobilePhone": {
"type": "string"
},
"officeLocation": {
"type": "string"
},
"preferredLanguage": {
"type": "string"
},
"surname": {
"type": "string"
},
"userPrincipalName": {
"type": "string"
}
}
}
}
},
"parameters": []
}
},
"/v1.0/me/onenote/pages": {
"post": {
"summary": "Create new OneNote Page with picture",
"operationId": "PostPage",
"consumes": [
"multipart/form-data"
],
"responses": {
"201": {
"description": "Created new page with uploaded picture",
"schema": {
"type": "object",
"properties": {
"@odata.context": {
"type": "string"
},
"id": {
"type": "string"
},
"self": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"title": {
"type": "string"
},
"createdByAppId": {
"type": "string"
},
"contentUrl": {
"type": "string"
},
"lastModifiedDateTime": {
"type": "string"
},
"links": {
"type": "object",
"properties": {
"oneNoteClientUrl": {
"type": "string"
},
"oneNoteWebUrl": {
"type": "string"
}
}
}
}
}
}
},
"parameters": [
{
"in": "formData",
"name": "card",
"type": "file",
"description": "a picture",
"required": true,
"x-ms-media-kind": "image"
},
{
"in": "formData",
"name": "Presentation",
"type": "file",
"required": true
}
]
}
}
},
"security": [
{
"OAuth2": []
}
],
"swagger": "2.0",
"schemes": [
"https"
],
"host": "graph.microsoft.com",
"basePath": "/",
"securityDefinitions": {
"OAuth2": {
"type": "oauth2",
"flow": "accessCode",
"authorizationUrl": "https://login.windows.net/common/oauth2/authorize?resource=https://graph.microsoft.com",
"tokenUrl": "https://login.microsoftonline.com/common/oauth2/token",
"scopes": {}
}
},
"x-components": {}
}