When I execute the following query on Exact Online:
use 450*** /* Replace anonymized *** by last three digits of division. */
set use-http-disk-cache false
set use-http-memory-cache false
select * from ExactOnlineREST..DocumentAttachmentFiles where id = to_guid('8b60ccb6-e89d-4397-a4ca-001d6f57a4eb')
I get an error:
itgenoda074: Uw sessie is verlopen. Meld je opnieuw aan. [Session expired]
itgenoda074: Not authenticated. Request to 'https://start.exactonline.nl/docs/SysAttachment.aspx?ID=8b60ccb6-e89d-4397-a4ca-001d6f57a4eb&_Division_=450***' gave response from 'https://start.exactonline.nl/docs/SysAccessDenied.aspx?Mode=128&_Division_=450***'.
This happens both directly after a long session as well as straight after log on, so the token is still valid.
How can I access the document using Invantive SQL?
I have all privileges on the Exact Online environment for the owning company.
The following will not help since it is a recursive API calls (from file metadata to actual blob):
set ignore-http-403-errors false
But you can ignore any errors during recursive retrieval of the actual binary blob:
set ignore-document-download-errors true
After that, run the following query to determine the document ID associated with the attachment:
select document from ExactOnlineREST..DocumentAttachmentFiles where id = to_guid('8b60ccb6-e89d-4397-a4ca-001d6f57a4eb')
And put the document GUID in the following query:
select * from exactonlinerest..documents where id=to_guid('VALUE FROM PREVIOUS QUERY')
Probably you will retrieve 0 rows. Sometimes the document attachment files continue to exist while the document is no longer available.
If so, report it to Exact Online themselves. Their APIs should return referential correct data.
If not, please extend your question.