Unable to select the items in multiselect through code

回答済み
新規投稿

コメント

2件のコメント

  • 正式なコメント
    Alex Novotny

    Hi Vijay, 

    Thank you for bringing this up! I have an answer for you. You will want to create a string array with the options you want. 



    Hope this helps! 

    Thanks, 

    Alex, Box Developer Advocate

    private static async Task CreateMetadataTemplateInstance(BoxClient adminClient)
    {
    string[] selectedOptions = { "Author1", "Author2"};
    var metadataValues = new Dictionary<string, object>()
    {
    { "author", selectedOptions }
    };

    var metadata = await adminClient.MetadataManager.SetFileMetadataAsync(fileId: "123456", metadataValues, "enterprise", "multiselecttest");

    Console.WriteLine("Instance Added To File: ", metadata.ToString());

    }
    コメントアクション Permalink
  • Vijay Krishnan1

    I tried with the below also and getting the same error.

    List<string> lstSelectedAuthors = new List<string>() { "Author2", "Author3" };
    var metadataValues = new Dictionary<string, object>();

    metadataValues.Add("author", JsonConvert.SerializeObject(lstSelectedAuthors));

    var metadata = await _boxClient.MetadataManager.SetFileMetadataAsync(123456, metadataValues, "enterprise", "multiselecttest");

    0
    コメントアクション Permalink

サインインしてコメントを残してください。