More in this section

Forums / Developing with Sitefinity / Document unavailable after upload and publishing

Document unavailable after upload and publishing

1 posts, 0 answered
  1. Nathan
    Nathan avatar
    0 posts
    Registered:
    07 Aug 2017
    07 Aug
    Link to this post

    I have a thread that checks for a file being uploaded every X. Currently, if the document is not present, then uploaded and published, the call to GetDocuments never returns that document. The only way it shows up through the GetDocuments call is if the application is restarted. Is there a refresh/flush I need to call when accessing the LibrariesManager and GetDocuments call this way?

     

    Example:

    void Foo()
    {
        new Thread(() =>
        {
            while (true)
            {
                int t = 1000 * 60 * 2;
                Thread.Sleep(t);
     
                var libMngr = LibrariesManager.GetManager();
                var docList = libMngr.GetDocuments()
                    .Where(d => d.Title.Equals("DocumentTitle"));
     
                Log.Write(docList.Count(), ConfigurationPolicy.Debug);
            }
        }).Start();
    }
1 posts, 0 answered