[URGENT] Problem getting a document when quering on MediaURL
Hello,
I'm using an httpmodule to increase the viewcount of a document, prior to SP1 it was working this way:
string urlPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
var man = LibrariesManager.GetManager();
var cc = man.GetDocuments().FirstOrDefault();
var documents = man.GetDocuments().Where(o1 => o1.MediaUrl == urlPath );
if (documents.Count() > 0)
int r = 0; //<- won't get here
//var documents = entity.Documents().Where(o => o.Status == ContentLifecycleStatus.Live && o.MediaUrl == urlPath);
//var documentContainer = documents.Get();
//if (documentContainer.Count() > 0)
Hi Paolo,
In the code below you need to replace the row
var documents = man.GetDocuments().Where(o1 => o1.MediaUrl == urlPath );
with
var documents = man.GetDocuments().ToList().Where(o1 => o1.MediaUrl == urlPath );
Let us know if you find any further issues!