Forum Discussion

Amazon777's avatar
Amazon777
Regular Visitor
1 year ago
Solved

User Defined Fields In Outlook are not displaying in Power Query

I have successfully linked Outlook to Power Query. I can bring in the Subject, Sender. 

I cannot seem to find the User Defined Fields as column choices within Power Query. 

 

 

 

Thanks,

Josh

  • I decided not to use Power Query.

     

    Thank you for all your help. 

     

    This is a solution to pull out from Outlook User Defined fields including the subect and other fields within the email from and a folder in the Inbox named "test folder". 

     

    Team - I worked with a colleague this morning and he gave me a solution using VBA in Outlook.   

    I loaded this module into Outlook VBA. 

     

     

    Sub Test()


    'On Error Resume Next

    Dim objNS As Outlook.NameSpace: Set objNS = GetNamespace("MAPI")

    Dim olFolder As Outlook.MAPIFolder

    'Set olFolder = objNS.GetDefaultFolder(olFolderInbox)

    Dim Item As Object

    Set olFolder = Application.Session.GetDefaultFolder(olFolderInbox).Folders("test folder")

    For Each Item In olFolder.Items


    Dim oMail As Outlook.MailItem: Set oMail = Item

    If oMail.UserProperties.Find("Action") Is Nothing Or _
    oMail.UserProperties.Find("Risk") Is Nothing Or _
    oMail.UserProperties.Find("Incident") Is Nothing Then
    Debug.Print oMail.Subject & " | " & _
    oMail.SenderName & " | " & _
    oMail.ReceivedByName & " | " & _
    oMail.CC & " | " & _
    oMail.ReceivedTime

    Else

    Debug.Print oMail.Subject & " | " & _
    oMail.SenderName & " | " & _
    oMail.ReceivedByName & " | " & _
    oMail.CC & " | " & _
    oMail.ReceivedTime & " | " & _
    oMail.UserProperties.Find("Action").Value & " | " & _
    oMail.UserProperties.Find("Risk").Value & " | " & _
    oMail.UserProperties.Find("Incident").Value

    End If


    Next

    End Sub

     

6 Replies

  • Hi Amazon777 , Actually i think user defined fields for outlook are not there in Power Query instead please try these 

    • Export Outlook data with user-defined fields to Excel via View Settings and load it into Power Query.
    • Use a VBA script to extract emails with user-defined fields to a CSV and import into Power Query.
    • Retrieve emails and fields programmatically using Microsoft Graph API, saving results in JSON or Excel.
    • Automate extraction with Power Automate, saving data to SharePoint or Excel for Power Query access.
      If this post helped you please do give a kudos and accept this as a solution
      Thanks in Advance

     

     

  • v-aatheeque's avatar
    v-aatheeque
    Community Support

    Hi Amazon777 ,
    Thanks for reaching out to the Microsoft Fabric Community forum.

    It sounds like you're trying to access User Defined Fields (UDFs) from Outlook in Power Query, but they're not appearing as column choices. Here are a few steps you can try to resolve this :

    • Ensure that the UDFs are properly set up and saved in your Outlook properties. Sometimes, UDFs need to be saved and refreshed in Outlook before they appear in Power Query.
    • As a workaround, you can export your Outlook data, including UDFs, to an Excel file. Then, import the Excel file into Power Query2. This method ensures that all fields, including UDFs, are available for use.

    You can export Outlook tasks to an Excel file and then import the Excel file into Power BI Desktop for analysis below are the links : How to extract or export tasks list to Excel in Outlook?
    How to export Outlook task to Excel, CSV and Outlook Message (msg) - evo's smarter life

    If this post was helpful, please consider marking Accept as solution to assist other members in finding it more easily.

    If you continue to face issues, feel free to reach out to us for further assistance!




    • Amazon777's avatar
      Amazon777
      Regular Visitor

      thank you - I am a fairly new to Power Query. 

      I appreciate the time you took to look at my issue. 


      I will check to see if this solution works for me. 

       

      Thanks,

      Josh

  • Amazon777's avatar
    Amazon777
    Regular Visitor

    thank you - I am a novice so I will explore these solutions.

    I appreciate the time you took to answer me. 

     

    Thanks,

    Josh

  • Amazon777's avatar
    Amazon777
    Regular Visitor

    I decided not to use Power Query.

     

    Thank you for all your help. 

     

    This is a solution to pull out from Outlook User Defined fields including the subect and other fields within the email from and a folder in the Inbox named "test folder". 

     

    Team - I worked with a colleague this morning and he gave me a solution using VBA in Outlook.   

    I loaded this module into Outlook VBA. 

     

     

    Sub Test()


    'On Error Resume Next

    Dim objNS As Outlook.NameSpace: Set objNS = GetNamespace("MAPI")

    Dim olFolder As Outlook.MAPIFolder

    'Set olFolder = objNS.GetDefaultFolder(olFolderInbox)

    Dim Item As Object

    Set olFolder = Application.Session.GetDefaultFolder(olFolderInbox).Folders("test folder")

    For Each Item In olFolder.Items


    Dim oMail As Outlook.MailItem: Set oMail = Item

    If oMail.UserProperties.Find("Action") Is Nothing Or _
    oMail.UserProperties.Find("Risk") Is Nothing Or _
    oMail.UserProperties.Find("Incident") Is Nothing Then
    Debug.Print oMail.Subject & " | " & _
    oMail.SenderName & " | " & _
    oMail.ReceivedByName & " | " & _
    oMail.CC & " | " & _
    oMail.ReceivedTime

    Else

    Debug.Print oMail.Subject & " | " & _
    oMail.SenderName & " | " & _
    oMail.ReceivedByName & " | " & _
    oMail.CC & " | " & _
    oMail.ReceivedTime & " | " & _
    oMail.UserProperties.Find("Action").Value & " | " & _
    oMail.UserProperties.Find("Risk").Value & " | " & _
    oMail.UserProperties.Find("Incident").Value

    End If


    Next

    End Sub

     

    • v-aatheeque's avatar
      v-aatheeque
      Community Support

      Hi Amazon777 ,

      Glad that your query got resolved and If our response addressed by the community member for your query, please mark it as Accept Answer and click Yes if you found it helpful.

       

      Should you have any further questions, feel free to reach out.
      Thank you for being a valued member of the Microsoft Fabric Community Forum!