Abdulahi_Abdi's avatar
Abdulahi_Abdi
Former Employee
Feb 09, 2022
Status:
New

Adding voting option in Microsoft Graph API

Hi, I was working on a C# console application that sends email messages to a recipient using Graph API, and I needed a voting option in which the recipient can use. Was wondering if such a functionality could be added, thanks.

4 Comments

  • AnnamalaiSwamy's avatar
    AnnamalaiSwamy
    Copper Contributor

    Thanks for the pointer. I tried to convert to C# equivalent, but unable to make it up.  Is there any C# equivalent code available.

     

    I tried with the following C# code, mail is sent, but Voting option is not available in the mail:

     

    var message = new Message
    {
    Subject = subject,
    Body = new ItemBody
    {
    ContentType = BodyType.Html,
    Content = htmlBody
    },
    //Attachments = attachments,
    ToRecipients = recipients,
    //SingleValueExtendedProperties = new MessageSingleValueExtendedPropertiesCollectionPage()
    //{
    // new SingleValueLegacyExtendedProperty()
    // {
    // Id = String.Format("String {{{0}}} Name {1}","66f5a359-4659-4830-9070-00047ec6ac6e","Value"),
    // Value = "One" //_list //new List<string>("One","Two","Three","Four")
    // }
    //}
    MultiValueExtendedProperties = new MessageMultiValueExtendedPropertiesCollectionPage()
    {
    new MultiValueLegacyExtendedProperty()
    {
    Id = String.Format("StringArray {{{0}}} Name {1}","66f5a359-4659-4830-9070-00047ec6ac6e","Value"),
    Value = new string[]{"One","Two","Three","Four" } // _list
    }
    }};

     

    var sendmail = graphClient.Users[Config.UserID].SendMail(message, true);

    try
    {
    await sendmail.Request().PostAsync();
    sent = true;
    }
    catch (Exception ex)
    {
    Logger.Log("Email Cannot be sent:" + ex.Message);
    }

     

    Thanks,

    Annamalai

  • AnnamalaiSwamy's avatar
    AnnamalaiSwamy
    Copper Contributor

    Hi,

     

       Is there a way to Programmatically add the Voting options using Graph API in C#.  

     

    Thanks,

    Annamalai.