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:
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?
We are experiencing the exact same issue described by Jacques when retrieving DynamicContent items. Consider this code:
As far as I can tell, the master version returned from Sitefinity is the current version---no draft versions were created after the most-recent master version and all of the master item's properties suggest it is the published version---so that leaves us with this ugly workaround:
Is there a reason manager.Workflow.GetLive() is not returning the published version of a content item even though one exists?