I'm trying to extract the URL for a published document in a custom widget built in an external project.
The code is as follows:
(LinkToTermsAndConditions != Guid.Empty)
var doc = Telerik.Sitefinity.App.WorkWith().Document(documentGuid).GetLive().Get()
//LibrariesManager librariesManager = new LibrariesManager();
//var document = librariesManager.GetDocuments().Where(d => d.Id == documentGuid).FirstOrDefault();
//if (document != null)
// document = librariesManager.Lifecycle.GetLive(document) as Telerik.Sitefinity.Libraries.Model.Document;
TermsAndCondtions.HRef = doc.Url;
I've tried both the Fluent and normal approaches and in both cases if I just get the document, it retrieves it successfully but as soon as I try to get the current live version, it returns null.
In line 3 above, the Fluent version, I get an exception "An exception of type 'System.Reflection.AmbiguousMatchException' occurred in mscorlib.dll but was not handled in user code"
However when I run:
I get a document URL.
I've confirmed that the document, a PDF, is definitely published.
Why does the call to Lifecycle.GetLive always return null?