Download the Particular attachment from the Outlook

Hi All,

Could you please help me how to download the Particular attachment from the out look based upon the Particular Day.

My Requirement is I have to look check the mails on last Thursday or Friday date for a particular user and have to download the Particular attachment among the Different Attachments.

so If i am running the bot today(17/08/2022) I have to look in to the outlook for the (11/08/2022 and 12/08/2022) Day mails for a user(Example:Srinivas) and in that mail there will be many attachments and I have to download the Only one attachment (Ex: Data File)

Could you please suggest the Best approach

Thanks

Get all mail messages , then loop it and then check in if condition
please refer below

@srinusoft37

you will have a number of filtering options there ,

Thanks For Quick reply, I can able to filter using the subject and as well as Sender. But I want to download the particular attachment among all the Attachments available.

I tries like item.attachments.contains(β€œValue Required”)

But this is going to False state

Thanks

Hello @muhamed.fasil ,

  1. Get current weekday
    WeekOfDay (of type System.DayOfWeek)= System.Globalization.CultureInfo.InvariantCulture.Calendar.GetDayOfWeek(FilterDate)

FilterDate is of type DateTime (initialize Now value)

  1. Use an While loop and check if : WeekOfDay= DayOfWeek.Thursday
    in loop body assign FilterDate = FilterDate.AddDays(-1)
    Update WeekOfDay value as per above expression given in step 1.

Once it matches you will be having last week Thursday date in your FilterDate Variable.

  1. Use get outlook mail message and use filter Property to filter and read Thursday Email (you can add +1 and use And operation in filter to read Friday as well)

  2. In Save attachment activity filter provide the required file extension.
    Ex : .xlsx|.pdf

Regards,
Rohith

1 Like

Hey @srinusoft37,

  1. You can use the β€œ[Received] >= '” + DateTime.Today.AddDays(-(Convert.ToInt32(DateTime.Today.AddDays(-4).DayOfWeek))).ToString(β€œd”) + " 00:00AM’ AND [Received] <= β€˜"+ DateTime.Today.AddDays(-(Convert.ToInt32(Now.AddDays(-5).DayOfWeek))).ToString(β€œd”) + " 23:59’" this expression in the Filter property of get outlook mail message.
  2. In Save attachment activity filter provide the required file extension.
    Ex : .xlsx|.pdf

Thanks,
Sanjit

1 Like

In the Log message I am able to get the Last thrusday and friday dates but While i am using in the outlook Filter condition This is Trowing an error like β€œCANNOT PARSE CONDITION ERROR AT’8/11/2022”.

I directly use your condition in the Filter section in the Outlook activity

Thanks

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.