Replies: 2 comments 7 replies
-
Updates to the discussion have been made in: For the TL;dr, the Kiota abstractions deep-dive pages are located here: |
Beta Was this translation helpful? Give feedback.
-
target := "My Message"
// Iterate over all pages (e.g. Messages)
iterateErr := pageIterator.Iterate(func(pageItem interface{}) bool {
message := pageItem.(models.Messageable)
fmt.Printf("%s\n", *message.GetSubject())
if target == *message.GetSubject() {
writer, err := requestAdapter.GetSerializationWriterFactory().GetSerializationWriter("application/json")
err := writer.WriteObjectValue("", message)
serializedValue, err := writer.GetSerializedContent()
// do something with the serialized value like persist it or send to another process etc...
parseNode, err := absser.DefaultParseNodeFactoryInstance.GetRootParseNode("application/json", serializedValue)
deserializedValue, err := parseNode.GetObjectValue(models.CreateMessageFromDiscriminatorValue)
// do something with the deserialized value
// Return true to continue the iteration
return true
}) absser is an import of github.com/microsoft/kiota-abstractions-go/serialization
|
Beta Was this translation helpful? Give feedback.
-
How can SDK be used to write retrieved items?
Related to: #140
In the code example: https://docs.microsoft.com/en-gb/graph/sdks/paging?tabs=Go
The snippet highlights how to receive each Message from the Mailbox. Messages are defined [here][]
The SerializationWriter Interface is defined within Kiota abstractions, but it is unclear which how to save a particular message to an app.
Code is adapted from provided code above:
How do you get the value out of the value?
Golang produces the following error:
If the code for val is changed to
val( message )
, the error becomes:This conflict seems to exist in the Kiota Library. I'm unsure if changing the code in the
models
directory will satisfy the complaint or if it requires a change to the serialization framework in Kiota or if it could be the case that I'm not seeing something the actual solution.Beta Was this translation helpful? Give feedback.
All reactions