We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Adding documents when using SharePoint instead of so_arc

We're looking an issue for one of our users that tries to add documents to SuperOffice with our products. The user has a SuperOffice tenant that is configured to use SharePoint instead of so_arc for document storage. We use a system user because this is a background process/application. The following error occurs when uploading a new document:

WCF Method failed on Server. SO-Exception-FriendlyText: Cannot acquire valid access-token without a valid refresh-token. SO-Exception-InnerMostExceptionMessage: Cannot acquire valid access-token without a valid refresh-token. ---> SuperOffice.Exceptions.SoServerException: WCF Method failed on Server
   at SuperOffice.CRM.Services.WcfProxy.Services86.SoWcfClient`1.Execute[TResponse](OnExecute`1 method)
   at SuperOffice.CRM.Services.WcfProxy.Services86.SoWcfClient`1.Execute[TRequest,TResponse](OnPrepareRequest`1 prepareRequest, OnExecute`2 method)
   at SuperOffice.CRM.Services.WcfProxy.DocumentEntityProxyCustom.SetDocumentStream(DocumentEntity document, Boolean overwriteExistingData)
   at SuperOffice.CRM.Services.WcfProxy.DocumentEntityProxyCustom.SetDocumentStream(DocumentEntity document, Stream stream, Boolean overwriteExistingData)
   at SuperOffice.CRM.Services.WcfProxy.Services86.DocumentAgentWcfProxy.SetDocumentStream(DocumentEntity documentEntity, Stream stream, Boolean overwriteExistingData)

I saw this post from Frode (using REST, but that should not make a difference here)  about the same error message where the work-around is to not use a system user. That's unfortunetely not an option for us. 

Are there any solutions or alternatives? We rely heaviliy on system users in various products and I'm worried we will run into this issue more often when more customers start using so_arc alternatives. 

RE: Adding documents when using SharePoint instead of so_arc

Hi Matthijs, did you figure out anything here?

The error we had went away for a few months (I don't remember what I did), but now it's back again.

Av: Frode Lillerud 10. jun 2020

RE: Adding documents when using SharePoint instead of so_arc

Unfortunately not yet. The only way in which I see this working for system users is to somehow give it access to SharePoint using delegated access. 

Otherwise the 'system user' concept will be broken and unusable for Sharepoint customers.

Av: Matthijs Wagemakers 11. jun 2020

RE: Adding documents when using SharePoint instead of so_arc

I worked with Frode on this yesterday. It seems Microsoft uses sliding expiration on their tokens. When not used for a period of time they will expire. Then a MS user will have to signout/signin again to refresh their token in order for the process to continue. 

This is the only way we were able to get it working for Frode yesterday. I do not believe there is anything SuperOffice can do to change this behavior. Perhaps, under these circumstances, your application prompts the Office365 user to signin again.

Best regards.

Av: Tony Yates 11. jun 2020

RE: Adding documents when using SharePoint instead of so_arc

Thanks for responding Tony. 

However, Frode's issue is different. My problem is how this is supposed to work in the system user world. Is there any way for system users to get access to sharepoint documents?

Av: Matthijs Wagemakers 11. jun 2020

RE: Adding documents when using SharePoint instead of so_arc

Hi Matthijs,

No. The only users with sharepoint document access are Office365/Azure AD users. So an Azure admin would have to create the "system user" (actually a normal associate) as an AD user and give it the appropriate permissions. 

Best regards.

Av: Tony Yates 11. jun 2020