I have some problems to implementing previews on unpublished documents in development.
In development it not works as expected. I have a document not found on drafts.
The problem is on the following line
var response = await Query(p).Ref(reference).Lang(lang).Submit();
The document could not be found with the reference Master.Reference equal "XXXXXXXXXXXXXhVT"
public async Task QueryFirst(IPredicate p, string reference = null, string lang = null)
{
reference = reference ?? Master.Reference;
lang = lang ?? "*";
var response = await Query(p).Ref(reference).Lang(lang).Submit();
var results = response.Results;
return results.FirstOrDefault();
}
public async Task GetByID(string documentId, string reference = null, string lang = null)
{
reference = reference ?? Master.Reference;
lang = lang ?? "*";
return await QueryFirst(Predicates.At("document.id", documentId), reference, lang);
}
Thanks for reaching out, I don't know much about .Net, but I will try to investigate with you.
As a start, can you tell me what .Net kit you are using?