Sharepoint activities error O365 Classic

I am trying to upload files to Sharepoint using O365 Classic Scope authenticated by App Id and Secret.

Our implementation works fine with all sites we have on production, but we receive an error when trying to develop an implementation for a recently created site. I literally used the same code and dependencies as working implementations.

We are using O365 activities 2.8.22 on Studio 2024.10.1 . Are there any recommended configuration that I shall look into or pass on to our System Admin?

Type ‘Microsoft.Graph.ServiceException’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.

System.Exception: Type ‘Microsoft.Graph.ServiceException’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required. —> System.Runtime.Serialization.InvalidDataContractException: Type ‘Microsoft.Graph.ServiceException’ cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. Alternatively, you can ensure that the type is public and has a parameterless constructor - all public members of the type will then be serialized, and no attributes will be required.

Can you try by providing Application Permissions instead of Delegated Permissions for the Graph API in your custom App in Azure App registration and then ask the admin to consent those permissions in Azure?

Try to auth with App ID and Secret.

1 Like

Also,

My suggestion is to try to use the new Upload Activity using Integration Service Connection, as it is the latest one and will receive new features and fixes faster.

Activities - Upload Files

Thank you,

So as per my support team, the Permissions are setup as App. Is weird as the same code works in production on a different site

I agree, sadly is not an option right now. But I’ll bring the topic to our System Admins.

May be @ovidiuponoran can advise?

Regards
Sonali

Can you perform the below and see if there are any improvements?

Delete these folders/files in the impacted robot VM if exists:

%localappdata%\DataStore.Office365
%appdata%\uipath\authentication

Log in to the Azure App and navigate to App Registration > Select the App > In the left Panel go to Certificates & secrets > Client Secrets.

Issue a new secret and paste the value in the Studio > Microsoft 365 Scope Activity.

Retry to run the impacted activity.

I believe I might be able to help here.

There are multiple issues that can be cascading and overlapping with each other.

Alot of these activities have really terrible exception messages.
For example in the Outlook activities, if you add an invalid email address in the send to field it states ‘An unknown exception occurred’, if you make other errors it says ‘An unknown exception occurred.’ and it keeps going, I think they turn them all into that.

Mercifully, the actual exception, which is very useful, is on the innerexception, but thats not easily seen in the Orchestrator logs, so you need to add custom logging for errors to actually see it.
So you can firstly try adding some try catches around some of the faulting activities, serialize the error and log it, then rethrow the error. These logs can give very valuable insights into the real cause.
Doing this I think will already help diagnose the issue as you can see the real error rather than this one.

As for the serialization error. I believe I reported this last year.

@marian.platonov and @AlexCrijman I can try to dig out my original ticket where I believe I diagnosed it fully and reported it.

If I remember correctly, this error ONLY occurs if you are running a process that you have specified supports persistence and there is some sort of bug that falsely flags something as not serializable.

I am not sure if you are using any persistence, but perhaps you can confirm if that setting is set to true in your project?