Facing issue with saving the screenshot to a folder with current date time format


Facing below issue while executing my program.

"saveimage has thrown an exception

Source: Save image

Message: Save image failed. Check if the file name is a valid path

Exception Type: ImageOperationException

UiPath.Core.ImageOperationException: Save image failed. Check if the file name is a valid path —> System.NotSupportedException: The given path’s format is not supported.
at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
at System.IO.Path.GetFullPath(String path)
at System.Drawing.IntSecurity.UnsafeGetFullPath(String fileName)
at System.Drawing.IntSecurity.DemandWriteFileIO(String fileName)
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at System.Drawing.Image.Save(String filename, ImageFormat format)
at UiPath.Core.Image.SaveFile(String fileName)
— End of inner exception stack trace —
at UiPath.Core.Activities.TaskAsyncCodeActivity`1.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext context, IAsyncResult result)
at System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager). "

Can some one help me on above issue ?

this is a path issue, before save this image try to use, file exist/folder exist(you should validate if there is a file with same name then delete it/ appent something in front of name and save) check folder exist if its not found create folder and then save file.

Please find the attached screenshot for ref:

Didn’t find folder exists.