XQL filter o365 attachments

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

XQL filter o365 attachments

L2 Linker
Hi,
 
I am trying to filter o365 attachments without success, could you help pls
 
sample
[
  {
    "@odata.type": "#microsoft.graph.fileAttachment",
    "@odata.mediaContentType": "image/jpeg",
    "id": "AAMkADEzYjJhMzM1LTY0ODctNGUxOS05ZDc5LTQ2MWM3NzFmMTRjOABGAAAAAABaN8y0q3IrQ6fyDga7Z5M3BwBvSXHDOoi0TJ5-l2B-i9PgAAAAAAEMAADyHfSb-T8wR5Fak3aFlfaBAACPB9PLAAABEgAQAE8kDtOZeABMuRd54VyYgc4=",
 },
  {
    "@odata.type": "#microsoft.graph.fileAttachment",
    "@odata.mediaContentType": "image/png",
    "id": "AAMkADEzYjJhMzM1LTY0ODctNGUxOS05ZDc5LTQ2MWM3NzFmMTRjOABGAAAAAABaN8y0q3IrQ6fyDga7Z5M3BwBvSXHDOoi0TJ5-l2B-i9PgAAAAAAEMAADyHfSb-T8wR5Fak3aFlfaBAACPB9PLAAABEgAQAI8pDv4IgY1BhJhVm9_2_E8=",
}
]
 
 XQL
 
dataset = msft_o365_emails_raw |
| fields attachments as attach
| alter attachid = json_extract_scalar_array(to_json_string(arrayindex(attach, 0)) , "$.id")

 

Regards,

Fabio Ferreira

1 accepted solution

Accepted Solutions

L4 Transporter

Hi @FabioFerreira 

 

Thank you for writing to live community!

 

Assuming type of the field which contains above value is json, could you try this below:

 

| alter attachment_id = arraymap(json_extract_array(to_json_string(fieldname),"$."),json_extract_scalar("@element","$.id"))
| arrayexpand attachment_id

 

Hope this helps!

Please mark the response as "Accept as Solution" if it answers your query.


Regards.

View solution in original post

2 REPLIES 2

L4 Transporter

Hi @FabioFerreira 

 

Thank you for writing to live community!

 

Assuming type of the field which contains above value is json, could you try this below:

 

| alter attachment_id = arraymap(json_extract_array(to_json_string(fieldname),"$."),json_extract_scalar("@element","$.id"))
| arrayexpand attachment_id

 

Hope this helps!

Please mark the response as "Accept as Solution" if it answers your query.


Regards.

L0 Member

Hi @PiyushKohli 

 

It worked!

 

Thanks a lot 🙂

 

Regards,

  • 1 accepted solution
  • 1187 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!