web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Print Outlook Calendar...
Power Automate
Unanswered

Print Outlook Calendar to PDF

(0) ShareShare
ReportReport
Posted on by

Hi there,

 

I am new to Power Automate. 

 

I'm trying to build a flow that

 

1. Opens outlook

2. Navigates to my calendar

3. Selects File > Print (by default, my printer is AdobePDF)

4. Enter filename for the PDF, and directory in which I want it to be saved. 

5. Go ahead and save the file

 

The flow works fails after pressing the "print button".  The flow fails to enter the filename / directory.  Instead is says: Failed to write in textbox (failed to get window)

 

I have tried to include "get window" and "focus window" to ensure that PowerAutomate is looking at the specific "File Save As" window.  I have also tried selecting UI element (title of the window). The error message persists.

 

Can anyone advise on how to resolve this issue?

 

I provide screenshots of my process (including a screenshot of the saved pop-up window).

 

Best

 

Travis

 

Detailed error details below:

 

Exception of type 'Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.Exceptions.WindowNotFoundException' was thrown.: Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Failed to write in textbox (failed to get window) ---> Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.Exceptions.WindowNotFoundException: Exception of type 'Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.Exceptions.WindowNotFoundException' was thrown.
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.Proxy.RemoteAutomationRuntimeProxy.HandleResult[T](Func`2 func)
at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Actions.PopulateTextFieldInWindow.<>c__DisplayClass17_0.<Execute>b__0(IAutomationRuntime r)
at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Common.UIAutomationActionBase.PerformAutomation(Action`1 action, UIControl control)
at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Actions.PopulateTextFieldInWindow.Execute(ActionContext context)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.UIAutomation.Actions.PopulateTextFieldInWindow.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

 

 

 

Flow_3.png
Flow_2.png
Flow_1.png
I have the same question (0)
  • OkanMTL Profile Picture
    703 Super User 2024 Season 1 on at

    Hello,

     

    You don't need write to textbox action whenever File Explorer opens up, just use Send Keys action as the focus is automatically on writing file name. I would add a wait before. 

     

    FYOI, for printing and saving, you can solely use send keys actions.

    When u open outlook agenda, you can send keys:

    Leftcntrl+p = opens printscreen

    LeftAlt = open keyboardfunctions

    P = open printfunctions

    Y+3 = open weekly calender style

    Etc. This more realiable than click actions.

     

    Good luck.

     

     

  • rd27 Profile Picture
    4 on at

    Here are quick 4 steps to get a PDF file of Outlook Calendar. But it recommends saving Calendar in ICS so that you can Import ICS to Office 365 easily whenever required.
    Step 1. Open the MS Outlook and select the Calendar view icon.
    Step 2. Choose the Calendar to save as PDF > File > Print
    Step 3. Hit on the Microsoft Print to PDF option > Print.
    Step 4. Choose the Destination location and Save.

  • VishnuReddy1997 Profile Picture
    2,666 Super User 2026 Season 1 on at

    Hi @twinstanley ,

     

    Please find the attached solution. Instead of UI action I have use Send Keys shortcut action.

     

    VishnuReddy1997_0-1712821587039.png
    VishnuReddy1997_1-1712821638108.png

     

    Code:

    Please Copy this code to your Flow.

     

    DateTime.GetCurrentDateTime.Local DateTimeFormat: DateTime.DateTimeFormat.DateAndTime CurrentDateTime=> CurrentDateTime
    Text.ConvertDateTimeToText.FromCustomDateTime DateTime: CurrentDateTime CustomFormat: $'''MMMM''' Result=> FormattedDateTime
    Outlook.Launch Instance=> OutlookInstance
    WAIT 2
    MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Control}({2})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: True
    WAIT 2
    MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Control}({P})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: True
    WAIT 2
    MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{LWin}({Alt})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: True
    WAIT 2
    MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Control}({P})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: True
    WAIT 2
    MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''{Control}({P})''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: True
    WAIT 2
    MouseAndKeyboard.SendKeys.FocusAndSendKeys TextToSend: $'''C:\\Users\\OneDrive\\Desktop\\Power Automate Desktop\\Practice\\Text File\\Calendar_of_%FormattedDateTime%.pdf{Return}''' DelayBetweenKeystrokes: 10 SendTextAsHardwareKeys: True
    Outlook.Close Instance: OutlookInstance

     

    (Note:- if you got your solution you can mark as solution and gives kudos)

     

    Thanks & Regards

    Vishnu Reddy

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 468

#2
Haque Profile Picture

Haque 370

#3
Valantis Profile Picture

Valantis 354

Last 30 days Overall leaderboard