I have one more simple (I think) that surpassed me. I wrote a method in one of my controls that gets the latest version of a file in CMS, given its file name (that is, regardless of which folder the file is in). I found this useful enough to think that I dropped it into my CMSToolbox class, but when I do this, I can no longer use the Where()FileManager class method provided by CMS (which returns a list).
Here is a simplified example of my class:
using System;
using System.Collections.Generic;
using CMS.CMS;
using CMS.Core;
using CMS.Web;
namespace CoA.CMS {
public class ToolBox
{
public CMS.CMS.File getLatestFileVersionByFilename(string filename, int GroupID)
{
IList<CMS.CMS.File> fileWithName = FileManager.GetGroupAll(false, GroupID).Where(file => currentFileVersionIsNamed(file, filename)).ToList<CMS.CMS.File>();
return getLatestFileFromListOfFiles(fileWithName);
}
protected bool currentFileVersionIsNamed(CMS.CMS.File file, string name)
{
}
protected CMS.CMS.File getLatestFileFromListOfFiles(CMS.CMS.File file)
{
}
}
}
( , CMS, Control), Where(), ToolBox . ? , IList , .
, -:)
: Filemanager.GetGroupAll() a CMSList, IList