Microsoft graph API - Unable to move email with error 415 - microsoft-graph-api

I'm trying to use Microsoft Graph API to move email between inbox folders.
We per manual on https://learn.microsoft.com/en-us/graph/api/message-move?view=graph-rest-1.0&tabs=http
I'm trying to run a POST call https://graph.microsoft.com/v1.0/users/{userID}/messages/{messageID}/move
But all I get is error 415 Unsupported Media Type
{
"error": {
"code": "RequestBodyRead",
"message": "A supported MIME type could not be found that matches the content type of the response. None of the supported type(s) 'Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaType, Microsoft.OData.ODataMediaTyp...' matches the content type 'multipart/form-data; boundary=--------------------------951291014204912961424386'."
}
}
I can't figure it out. Any suggestions are appreciated.

The error I think is pointing out to the request body [Request Body][1]
[1]: https://graph.microsoft.com/v1.0/users/%7BuserID%7D/messages/%7BmessageID%7D/move Can you please check have you added in request body [request body reference][1]
[1]: https://i.stack.imgur.com/HWVgv.png DestinationId is Inbox

I was using Postman and forgot to disable original Content-type which generated the error

Related

How to programmatically get asset catalog color variants from Xcode 13 in SwiftUI / Swift5.5?

I have a color asset catalog in Xcode 13 that defines a set of colors in both light ("Any") and dark ("Dark") variants. For example:
I would like to programmatically enumerate the different colors, meaning, I'd like to get the color (Color("hkMagenta")) in both variants. Just getting it by name returns the "Any" variant.
How can I get the dark variant?
I had thought this would work:
ColorManager.hkMagenta.environment(\.colorScheme, .dark)
Unfortunately, no-go...
Cannot convert value of type 'some View' to expected element type 'Array<Color>.ArrayLiteralElement' (aka 'Color')
Any ideas?
You can specify .colorScheme for each view depending upon your needs like
import SwiftUI
struct ContentView: View {
var body: some View {
VStack(spacing: 20){
Text("Light Magenta color from asset")
.font(.headline)
.foregroundColor(Color("hkMagenta"))
.environment(\.colorScheme, .light) //ColoScheme
Text("Dark Magenta color from asset")
.font(.headline)
.foregroundColor(Color("hkMagenta"))
.environment(\.colorScheme, .dark) //ColoScheme
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Thanks to #Asperi for pointing out https://stackoverflow.com/a/66950858/12299030.
TL;DR is, you can get the light and dark variants using UIColor.resolvedColor() like so:
let c = Color(UIColor(named: "hkMagenta")!.resolvedColor(with: UITraitCollection(userInterfaceStyle: .dark)))

How do I arrange SwiftUI Toolbar items?

I have a SwiftUI ToolBar with 4 buttons, however the code I implemented is not correct because the buttons end up in weird places when changing the device type in simulator.
Even worse, when viewed on iPhone 8 / 8 Plus, 2 of the buttons are on the far edges of the window.
How do I properly apply spacing/padding to ToolBar buttons so they are consistent across different iOS devices?
Thank you!
// This code spaces the buttons but they change positions depending on the iOS device
ToolbarItem {
HStack {
HStack {
ProfileUploadMediaButton()
}.padding([.trailing], 85)
HStack {
ProfileUsernameButton()
}.padding([.trailing], 84)
HStack {
ProfileLiveButton()
}.padding([.trailing], 6)
HStack {
AccountButton()
}.padding([.trailing], 12)
}
}
})
// I was thinking code like this but all buttons are bunched together on the right-side of // the screen...
ToolbarItem {
HStack {
ProfileUploadMediaButton()
ProfileUsernameButton()
ProfileLiveButton()
AccountButton()
}
}
When you add ToolbarItems, there is an initializer where you can explicitly set the placement of each item. For your case, you would add 3 ToolbarItems, for the left, center, and right. I'd mention that the toolbar is meant to be dynamic, so it may look different on different devices on purpose.
struct ToolbarView: View {
var body: some View {
NavigationView {
VStack {
Text("Hello, world!")
}
.navigationTitle("Test")
.toolbar(content: {
ToolbarItem(placement: .navigationBarLeading) {
Image(systemName: "camera.fill")
}
ToolbarItem(placement: .principal) {
Text("Username")
}
ToolbarItem(placement: .navigationBarTrailing) {
HStack {
Image(systemName: "dot.radiowaves.left.and.right")
Image(systemName: "heart.fill")
}
}
})
}
}
}
Per the documentation, here are the placement options. I'm guessing that when you don't explicitly add a placement, they default to .automatic.
automatic:
The item is placed automatically, depending on many factors including the platform, size class, or presence of other items.
bottomBar:
The item is placed in the bottom toolbar. Applies to iOS, iPadOS, and Mac Catalyst.
cancellationAction:
The item represents a cancellation action for a modal interface.
confirmationAction:
The item represents a confirmation action for a modal interface.
destructiveAction:
The item represents a destructive action for a modal interface.
navigation:
The item represents a navigation action.
navigationBarLeading:
The item is placed in the leading edge of the navigation bar. Applies to iOS, iPadOS, tvOS, and Mac Catalyst.
navigationBarTrailing:
The item is placed in the trailing edge of the navigation bar. Applies to iOS, iPadOS, tvOS, and Mac Catalyst.
primaryAction:
The item represents a primary action.
principal:
The item is placed in the principal item section.
ToolbarItemPlacement:
The item represents a change in status for the current context.

Preview of Apple system font sizes (e.g. body, callout, caption, etc.)?

When choosing a font for Text, for example, we can change the font size using:
Text("Hello world").font(.system(.body))
In this case, body is a Font.TextStyle with the following options:
case largeTitle
case title
case headline
case subheadline
case body
case callout
case footnote
case caption
When deciding which font to choose for a component, I'd like to get an idea of what the font looks like. I found this Apple page which details the specs for some fonts:
However, these don't match up 1:1 with Font.TextStyle, and they don't include a preview. Is there anywhere with a preview of these sizes for some of the more common dynamic type sizes (e.g. xSmall, xxxLarge)?
The only image I've found is this:
Alternatively, you can also preview this easily in SwiftUI:
struct Font_Previews: PreviewProvider {
static var previews: some View {
let allTextStyles: [(Font.TextStyle, String)] = [
(.largeTitle, "largeTitle"),
(.title, "title"),
(.headline, "headline"),
(.subheadline, "subheadline"),
(.body, "body"),
(.callout, "callout"),
(.footnote, "footnote"),
(.caption, "caption"),
]
assert(Set(Font.TextStyle.allCases) == Set(allTextStyles.map { $0.0 }), "Is one of the styles missing?")
return
ScrollView {
VStack {
VStack {
Text("Extra small")
ForEach(Array(allTextStyles.enumerated()), id: \.offset) { index, textStyle in
Text(textStyle.1).font(.system(textStyle.0))
}
}.environment(\.sizeCategory, .extraSmall)
Divider()
VStack {
Text("Default")
ForEach(Array(allTextStyles.enumerated()), id: \.offset) { index, textStyle in
Text(textStyle.1).font(.system(textStyle.0))
}
}
Divider()
VStack {
Text("Extra extra extra large")
ForEach(Array(allTextStyles.enumerated()), id: \.offset) { index, textStyle in
Text(textStyle.1).font(.system(textStyle.0))
}
}.environment(\.sizeCategory, .accessibilityExtraExtraExtraLarge)
}
}
}
}

show highcharts node text from beginning if the text is to long

If the text in the highchart node is longer than the node only a part of the text is displayed. This is okay. But how can I show allways the beginning of the text?
I tried to set verticalAlign to top but this pushes only the displayed text to the top of the node and don't show a other part of the text.
It is the node with
title: Merkmale | Makro zur Prüfung
description: [MORE.OAI] Office AddIn(370/454,6)CR: OfficeAddin/DMS-AddIn für MS-Outlook, MS-Excel und MS-Word [OAI](/449,1)
It shows
(370/454,6)
CR: OfficeAddin/DMS-AddIn für MS-Outlook,
but it should show
Merkmale | Makro zur Prüfung
[MORE.OAI] Office AddIn
Example Code https://jsfiddle.net/omurx8Lk/4/
You can use the dataLabels.nodeFormat to control what data label should display. By default dataLabel displayed the description (has higher priority than name) or name.
Demo: https://jsfiddle.net/BlackLabel/r5hq2uds/
{
"id": "17698",
"name": "Merkmale | Makro zur Prüfung",
"color": "#AAAAAA",
"description": "[MORE.OAI] Office AddIn<br/>(370/454,6)<br/>CR: OfficeAddin/DMS-AddIn für MS-Outlook, MS-Excel und MS-Word [OAI]<br/>(/449,1)",
dataLabels: {
nodeFormat: '{point.name}'
}
},
API: https://api.highcharts.com/highcharts/plotOptions.organization.dataLabels.nodeFormat

Xcode 11: How do I get my content to display like this in landscape and portrait orientation?

How would I go about doing something like this?
portrait
landscape
I understand I need to use constraints, and I understand why, but I cannot wrap my head around actually applying the concept.
Not sure if this will solve your problem, but can be done with very little code with SwiftUI:
'''
VStack {
HStack {
Image("yourImageNameNoExtension")
Image("yourImageNameNoExtension")
}
HStack {
Button(action: {// Code you wish to run}) {
Text("Button")
}.padding()
Button(action: {// Code you wish to run}) {
Text("Button")
}.padding()
}
}
'''
Hope this helps.

Resources