I am reasonably new to C#, but not .NET development. I am new to Graph development and don’t have a whole heap of JSON experience.
I am trying to build the code that can be used to construct messages within my organisation. Ultimately the code will become an RPA code object.
I have a class for the message, which has classes defined for toRecipient, ccRecipient and bccRecipient. Creating and sending an email works fine when I have data for the To, CC and Bcc options. However, I get an error message if I only have To recipients and not cc or Bcc recipitents. Similarly I cannot send to bcc only, as the code is looking for values to the toRecipients and CC recipients. The Error Message is :
{"error":{"code":"ErrorInvalidRecipients","message":"At least one recipient isn't valid., Recipient '' is not resolved. All recipients must be resolved before a message can be submitted."}}
How do I make the sub classes for cc and BCC optional? – or is there syntax I can use to tell the API that cc and bcc fields are empty?
I build the class based on a message created using Postman, and then using Paste Special into my message class.