by using Microsoft Graph API 5.44 the field “description” (item.AdditionalData) is OK on Return.
If i use a API higher then 5.44 the Value of the Field is Microsoft.Kiota.Abstractions.Serialization.UntypedArray.
Here is how i read…
User.Description = ReadAdditionalValueAttributeRS((Dictionary<string, object>)item.AdditionalData, "description");
Part of Code…
try
{
System.Text.Json.JsonElement jo = (System.Text.Json.JsonElement)newProp.Value;
-->> newProp.Value = Microsoft.Kiota.Abstractions.Serialization.UntypedArray
if (jo.ValueKind == System.Text.Json.JsonValueKind.String)
{
sval = jo.GetString();
sResult = sval.Replace(Microsoft.VisualBasic.Constants.vbCrLf, @"rn");
break;
}
else if (jo.ValueKind == System.Text.Json.JsonValueKind.Array)
{
var elementContentEnumerator = jo.EnumerateArray();
while (elementContentEnumerator.MoveNext())
{
Console.WriteLine($"You are now at property {elementContentEnumerator.Current}");
sval += elementContentEnumerator.Current.ToString();
sval += " ";
}
sResult = sval.Trim().Replace(Microsoft.VisualBasic.Constants.vbCrLf, @"rn");
break;
}
}
Possible to check this value?
I currently switch back to Microsoft Graph API 5.44 while the value is OK.
I test with Versions 5.56, 5.57 and 5.58. The Return of value is not OK.
The class UntypedNode
is base class for UntypedArray
, UntypedString
, UntypedInteger
, UntypedBoolean
, etc. All Untyped
classes have GetValue()
method which returns the collection of untyped node, string, int, or bool value.
Check if the newProp.Value
is either UntypedArray
or UntypedString
and then use GetValue()
to read the value.
try
{
if (newProp.Value is UntypedString untypedString)
{
sval = untypedString.GetValue();
sResult = sval.Replace(Microsoft.VisualBasic.Constants.vbCrLf, @"rn");
break;
}
else if (newProp.Value is UntypedArray untypedArray)
{
foreach (var item in untypedArray.GetValue())
{
if (item is UntypedString itemUntypedString)
{
sval += itemUntypedString.GetValue();
sval += " ";
}
}
sResult = sval.Trim().Replace(Microsoft.VisualBasic.Constants.vbCrLf, @"rn");
break;
}
}
I’m afraid that working with UntypedNode
is not well documented by Graph SDK team.
1