Inconsistent Conversation ID Retrieval in Office JS Using getSelectedItemsAsync

WongYK 5 Reputation points
2025-01-03T08:17:56.9933333+00:00

When using Office.js to retrieve selected items with Office.context.mailbox.getSelectedItemsAsync, the conversationId value returns a string value "[object Object]". However, accessing the conversationId of the same emails through Office.context.mailbox.item.conversationId works as expected and provides the correct conversation ID. This inconsistency poses challenges in processing selected email threads.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,182 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
564 questions
Microsoft Copilot for Microsoft 365 Development
Microsoft Copilot for Microsoft 365 Development
Microsoft Copilot for Microsoft 365: Microsoft 365 Copilot refers collectively to Copilot experiences within Microsoft 365 applications.Development: The process of researching, productizing, and refining new or existing technologies.
207 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Tasadduq Burney 8,681 Reputation points MVP
    2025-01-03T08:19:59.8033333+00:00

    Check the data returned by getSelectedItemsAsync, Log the conversationId to see its structure. It might be an object, so you may need to dig into its properties

    Office.context.mailbox.getSelectedItemsAsync((result) => {
        if (result.status === Office.AsyncResultStatus.Succeeded) {
            result.value.forEach(item => {
                console.log(item.conversationId); // Check what’s actually being returned
            });
        } else {
            console.error(result.error);
        }
    });
    

  2. Vivek Bhakta MSFT 100 Reputation points Microsoft Vendor
    2025-01-21T11:21:43.2933333+00:00

    How to Collect and Store User Responses Using Power Automate and Power Apps:

    Using Power Automate and Power Apps:

    Create a SharePoint List:

    • First, create a SharePoint list to store the questions and user responses. The list should have columns for the topic, question, and user response.

    Set Up Power Automate Flow:

      - **Trigger**: Start with a trigger that initiates the flow when a new response is submitted in your chatbot.
      
         - **Initialize Variables**: Use the "Initialize variable" action to create an array variable that will store the user's responses.
         
            - **Append to Array Variable**: As each response is collected, use the "Append to array variable" action to add the response to the array.
            
               - **Update SharePoint List**: At the end of the conversation, use the "Create item" or "Update item" action to save the collected responses to your SharePoint list.
               
               **Design a Power App**:
               
                  - **User Interface**: Create a user-friendly interface in Power Apps where users can interact with the chatbot and submit their responses.
                  
                     - **Data Collection**: Use Power Apps to collect user responses and store them in a collection.
                     
                        - **Trigger Flow**: At the end of the conversation, trigger the Power Automate flow to process and save the responses.
                        
    

    Steps to Implement:

    1. Set Up Power Automate Flow:
      • Go to Power Automate and create a new flow.
      • Choose a trigger, such as "When a new response is submitted" from Microsoft Forms or any other relevant trigger.
      • Add actions to initialize and append to the array variable.
      • Use the "Create item" action to save the responses to the SharePoint list.
    2. Create Power App:
      • Open Power Apps and create a new app.
      • Design the app to include input fields for each question.
      • Use collections to store user responses.
      • Add a button to trigger the Power Automate flow at the end of the conversation.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

  3. Vivek Bhakta MSFT 100 Reputation points Microsoft Vendor
    2025-01-21T11:25:39.1966667+00:00

    How to Collect and Store User Responses Using Power Automate and Power Apps:

    Using Power Automate and Power Apps

    Create a SharePoint List:

    • First, create a SharePoint list to store the questions and user responses. The list should have columns for the topic, question, and user response.

    Set Up Power Automate Flow:

      - **Trigger**: Start with a trigger that initiates the flow when a new response is submitted in your chatbot.
      
         - **Initialize Variables**: Use the "Initialize variable" action to create an array variable that will store the user's responses.
         
            - **Append to Array Variable**: As each response is collected, use the "Append to array variable" action to add the response to the array.
            
               - **Update SharePoint List**: At the end of the conversation, use the "Create item" or "Update item" action to save the collected responses to your SharePoint list.
               
               **Design a Power App**:
               
                  - **User Interface**: Create a user-friendly interface in Power Apps where users can interact with the chatbot and submit their responses.
                  
                     - **Data Collection**: Use Power Apps to collect user responses and store them in a collection.
                     
                        - **Trigger Flow**: At the end of the conversation, trigger the Power Automate flow to process and save the responses.
                        
    

    Steps to Implement:

    1. Set Up Power Automate Flow:
      • Go to Power Automate and create a new flow.
      • Choose a trigger, such as "When a new response is submitted" from Microsoft Forms or any other relevant trigger.
      • Add actions to initialize and append to the array variable.
      • Use the "Create item" action to save the responses to the SharePoint list.
    2. Create Power App:
      • Open Power Apps and create a new app.
      • Design the app to include input fields for each question.
      • Use collections to store user responses.
      • Add a button to trigger the Power Automate flow at the end of the conversation.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.