Exception Message on Get Mail Activity: '$value' segment is not supported for file attachments and item attachments

I have an automation that has been running for a long period of time without any issues. Recently, I’ve begun to encounter this issue: Using the ‘Get Mail’ activity to retrieve messages from an email account that sometimes received my.sharepoint.com attachments. The Get Mail activity fails every time it encounters a message with one of these attachments.
image

Here is the exception message I’m getting:
Get Mail: Code: ValueRequestNotSupported
Message: ‘$value’ segment is not supported for the given attachment. ‘$value’ segment is only supported for File Attachments and Item Attachments.

I’m using a UiPath.MicrosoftOffice365.Activities.Office365ApplicationScope with a UiPath.MicrosoftOffice365.Activities.Mail.GetMail activity. Any help would be greatly appreciated.

It turns out that this happens when someone sends an attachment from an open email. In this case, we sent out a timesheet template (.xlsm) with a submit button that creates an email with the active workbook as an attachment. Because the users were opening the attachment from within Outlook and running the script, the script was attaching the active workbook (sharepoint enabled Outlook attachment) to the email object and sending.

If the users are to download the file and run the macro, it works perfectly. Being that we’re dealing with a large number of users, we can’t count on everyone to do this so we found a workaround outside of the email solution. Still not sure what could be done to handle for these types of attachments if we were to still be using the mail solution.

I have the same issue. In my case I am not able to identify the attachment which causes this issue as the automation is running on hundred of emails.

ERROR:
Error Message:Status Code: MethodNotAllowed
Microsoft.Graph.ServiceException: Code: ValueRequestNotSupported
Message: ‘$value’ segment is not supported for the given attachment. ‘$value’ segment is only supported for File Attachments and Item Attachments.
ClientRequestId: 9388e501-bcdb-430c-970e-ba5bcb664ac0

at Microsoft.Graph.SimpleHttpProvider.d__10.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Shared.Services.Graph.Mail.Extensions.GraphServiceClientExtensions.d__35.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at UiPath.Shared.Services.Graph.Mail.Extensions.GraphServiceClientExtensions.d__201.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at UiPath.Shared.Services.Graph.Mail.Services.GraphMessageParser1.d__9.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.Shared.Services.Graph.Mail.Services.GraphMessageParser`1.d__8.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at UiPath.MicrosoftOffice365.Services.GraphServiceClientProxy.d__85.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at UiPath.MicrosoftOffice365.Activities.Mail.GetMail.d__42.MoveNext()
— End of stack trace from previous location where exception was thrown —
at UiPath.Shared.Activities.AsyncTaskCodeActivityImplementation.EndExecute(AsyncCodeActivityContext context, IAsyncResult result)
at UiPath.Shared.Activities.AsyncTaskCodeActivity.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 Source: Microsoft.Graph.Core

Any solutions to this?

Hello @macovei.marian ,

I have also seen this issue in my workflow, It was causing because of the attachment which attached from SharePoint or from OneDrive directly.

But it got resolve when I use Microsoft office package 2.2.3 and System package 22.10.7. You can also try with this way.

2 Likes

That feeling when someone posts the perfect solution on the forums! :grin: Thank you!

1 Like