Error with Upload File and Upload Files

I’m getting an error with activities “Upload File” inside Classic “Use OneDrive & Sharepoint” scope (Upload File: One or more errors occurred. (A task was canceled.)) and with “Upload Files” inside “Microsoft 365 Scope” (Upload Files: Upload failed too many times. See InnerException for list of exceptions that occured.).

I’ve also tried the “Download file” activity which don’t gives any error, but I can’t find any downloaded file in my computer when it ends.

The other OneDrive activities seems to work properly (For each file/folder, Create Folder…).

image

@Airun

Please open the locals panel and open the exception details from there to check the exact exception

also for download use outvariable.LocalPath to get the location

cheers

1 Like

Details of issue in Classic 365 activity is:

RemoteException wrapping System.AggregateException: One or more errors occurred. (A task was canceled.) —> RemoteException wrapping System.Threading.Tasks.TaskCanceledException: A task was canceled.
at System.Threading.Tasks.Task.GetExceptions(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.ContinuableAsyncCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.MicrosoftOffice365.Activities.Office365BaseClientActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.MicrosoftOffice365.Activities.Office365ClientActivity`2.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)
at System.Activities.Runtime.ActivityExecutor.TryExecuteNonEmptyWorkItem(WorkItem workItem)
at System.Activities.Runtime.ActivityExecutor.OnExecuteWorkItem(WorkItem workItem)
at System.Activities.Runtime.Scheduler.Callbacks.ExecuteWorkItem(WorkItem workItem)
at System.Activities.Runtime.Scheduler.OnScheduledWork(Object state)
at System.Activities.Runtime.Fx.SendOrPostThunk.UnhandledExceptionFrame(Object result)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,
Object args,
Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,
Delegate callback,
Object args,
Int32 numArgs,
Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,
ContextCallback callback,
Object state)
at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext,
ContextCallback callback,
Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd,
Int32 msg,
IntPtr wParam,
IntPtr lParam,
Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd,
Int32 msg,
IntPtr wParam,
IntPtr lParam,
Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback,
Object args,
Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source,
Delegate callback,
Object args,
Int32 numArgs,
Delegate catchHandler)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority,
TimeSpan timeout,
Delegate method,
Object args,
Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd,
Int32 msg,
IntPtr wParam,
IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.Run()
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run()
at UiPath.Executor.Program.Main()
— End of stack trace from previous location —

--- End of inner exception stack trace ---

at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task1.get_Result()
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.ContinuableAsyncCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.MicrosoftOffice365.Activities.Office365BaseClientActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.MicrosoftOffice365.Activities.Office365ClientActivity`2.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)

And those details with the Office 365 scope one:

RemoteException wrapping UiPath.MicrosoftOffice365.Office365Exception: Upload failed too many times. See InnerException for list of exceptions that occured. —> RemoteException wrapping UiPath.MicrosoftOffice365.Office365InternalException: Upload failed too many times. See InnerException for list of exceptions that occured. —> RemoteException wrapping System.Threading.Tasks.TaskCanceledException: Upload failed too many times. See InnerException for list of exceptions that occured. —> RemoteException wrapping System.AggregateException: One or more errors occurred.

--- End of inner exception stack trace ---

at Microsoft.Graph.LargeFileUploadTask1.UploadAsync(IProgress1 progress,
Int32 maxTries)
at UiPath.MicrosoftOffice365.Files.Extensions.FilesExtensions.UploadStreamAsync(GraphServiceClient graphClient,
Stream stream,
DriveItem destination,
String cloudFileName,
ConflictBehavior conflictBehavior,
String account,
CancellationToken cancellationToken)
at UiPath.MicrosoftOffice365.Files.Extensions.FilesExtensions.UploadResourceAsync(GraphServiceClient graphClient,
IResource resource,
DriveItem destination,
String cloudFileName,
ConflictBehavior conflictBehavior,
String account,
CancellationToken ct)
at UiPath.MicrosoftOffice365.Files.Extensions.FilesExtensions.UploadResourceWithMetadataAsync(GraphServiceClient graphClient,
IResource resource,
DriveItem destination,
String cloudFileName,
ConflictBehavior conflictBehavior,
Dictionary`2 driveItemMetadata,
String account,
CancellationToken cancellationToken)
at UiPath.MicrosoftOffice365.Services.GraphServiceClientProxy.UploadFileAsync(UploadRequest request,
CancellationToken cancellationToken)
at UiPath.MicrosoftOffice365.Services.GraphServiceClientProxy.ResolveDestinationAndUploadFileAsync(UploadRequest request,
CancellationToken cancellationToken)
at UiPath.MicrosoftOffice365.Activities.Files.UploadFilesConnections.SafeExecuteAsync(AsyncCodeActivityContext context,
CancellationToken cancellationToken)
at UiPath.MicrosoftOffice365.Activities.BaseLeafConnectionServiceActivityWithoutBindings.ExecuteAsync(AsyncCodeActivityContext context,
CancellationToken cancellationToken)
— End of inner exception stack trace —

--- End of inner exception stack trace ---

at UiPath.MicrosoftOffice365.Activities.BaseLeafConnectionServiceActivityWithoutBindings.ExecuteAsync(AsyncCodeActivityContext context,
CancellationToken cancellationToken)
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.Shared.Activities.ContinuableAsyncCodeActivity.EndExecute(AsyncCodeActivityContext context,
IAsyncResult result)
at UiPath.MicrosoftOffice365.Activities.Office365BaseClientActivity.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)

@Airun

  1. Do you have write permissions on site?
  2. Which authentication are you using?
  3. Did you try giving account. for few authentications it is mandatory

cheers

Yes, I have full `permissions, I’m just trying in my own private folders for the moment. I’m connecting using the connection option “Add connection” and I connected my account following the steps.

By another side, for the download file, I’ve tried what you said but it gives me this path: C:\Users\my_username\AppData\Local\Temp\baol23e4.dir.txt

The files are in this path even if I don’t use the “Download file” activity, I can find and move them to another folder in my computer even if I don’t use any download activity for them. Additionnaly their name is so strange with this method.

@Airun

Use the classic download path

also in find files are you getting the correct drive item?

as I see the library name is ondrive it would generally be documents or shared documents etc

can you show your find files

also try with adding account

cheers

Try
’ Use Upload File or Upload Files activity
Catch ex As Exception
’ Log the exception detail
Log Message → ex.Message
’ If it’s an AggregateException, log the details of InnerExceptions
If TypeOf ex Is AggregateException Then
For Each innerEx As Exception In DirectCast(ex, AggregateException).InnerExceptions
Log Message → innerEx.Message
Next
End If
End Try

’ After Download File activity
Log Message → "File downloaded to: " + outVariable.LocalPath

Download file worked okey with classic activities.

For the upload, I’m already adding my account:

@Airun

for upload also please try with classic

cheers

Yes, I’m trying upload with classic, I gived you both error details.

@Airun

ca you show the classic find files and upload afiles properties you used

cheers

Download works ok:

But Upload fails with the error details I gived you in my first answers (Error with Upload File and Upload Files - #3 by Airun):

Properties:

HEY!! I rebooted my computer and now all OneDrive activities have disapeared!!!
No more OneDrive activities are available, I also checked since StudioX and also nothing. I’ve tried to search and download packages…nothing!!!

Is it the same for you?? What’s happening?!?!? :exploding_head: :flushed: :scream:

Hi everybody, today it works in one of the 2 processes where I was starting my tests :woman_shrugging:t4:

But still don’t have Microsoft 365 package and any OneDrive activity available when I create new processes. This is really strange… :face_with_spiral_eyes:

And now it stopped working again…but now this is the “Get file or folder” activity which is giving an error, it indicates “Get file or folder: Cannot find the expected service in the context”.

I really don’t understand what happens with OneDrive activities, this behavior is so crazy, I am the only one affected by this behavior?? :exploding_head: :face_with_spiral_eyes:

Full error message is:
23.10.3+Branch.support-v23.10.Sha.ceeb2a4c480c2b7a4d12600ae5d39a26b6930830

Source: Get file or folder

Message: Cannot find the expected service in the context

Exception Type: System.ArgumentException

System.ArgumentException: Cannot find the expected service in the context at UiPath.MicrosoftOffice365.Activities.Files.Services.DriveClientContextService.GetAccessInformation(InArgument1 metadata, ActivityContext context) at UiPath.MicrosoftOffice365.Activities.Files.GraphDriveClientActivity.GetRuntimeDriveAccessInformation(AsyncCodeActivityContext context) at UiPath.MicrosoftOffice365.Activities.Files.GetItem.ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken) at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at UiPath.Shared.Activities.AsyncTaskCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at UiPath.Shared.Activities.ContinuableAsyncCodeActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at UiPath.MicrosoftOffice365.Activities.Office365BaseClientActivity.EndExecute(AsyncCodeActivityContext context, IAsyncResult result) at UiPath.MicrosoftOffice365.Activities.Office365ClientActivity2.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)
strong text

After last UiPath update everything seems to be working fine now. :woman_shrugging:t4: :joy:

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