ramon.almarza-emtmadrid
-
2/3/2010 6:10:49 AM
select not published files in a folder
I’m triying to publish all the files in a folder of Kentico system file. I’m using this code:
public static List<CMS.TreeEngine.TreeNode> SelectNodesByPath(string path, string className, bool selectHiddenPages) { List<CMS.TreeEngine.TreeNode> listaNodos = new List<CMS.TreeEngine.TreeNode>(); DataSet ds = Functions.GetTreeProvider().SelectNodes(GetSiteName(), path + "/%", Functions.GetPreferredCulture(), true, className, "", "NodeOrder", 1); CMS.TreeEngine.TreeNode nodo; if (ds.Tables.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { CMS.PortalEngine.PageInfo pi = new CMS.PortalEngine.PageInfo(dr); nodo = new CMS.TreeEngine.TreeNode(dr, className); if (!pi.DocumentMenuItemHideInNavigation || selectHiddenPages) listaNodos.Add(new CMS.TreeEngine.TreeNode(dr, className)); } } return listaNodos; }
public static void publicarFicheros(String path) { List<CMS.TreeEngine.TreeNode> listaNodos = new List<CMS.TreeEngine.TreeNode>(); DataSet ds = Functions.GetTreeProvider().SelectNodes(GetSiteName(), path + "/%", Functions.GetPreferredCulture(), true); listaNodos = SelectNodesByPath(path, "CMS.File"); UserInfo ui = UserInfoProvider.GetUserInfo("administrator");
TreeProvider tree = new TreeProvider(ui); WorkflowManager wm = new WorkflowManager(tree); WorkflowStepInfo currentStep ; foreach (CMS.TreeEngine.TreeNode nodo in listaNodos) { // Approve until the step is publish currentStep = wm.GetStepInfo(nodo); while ((currentStep != null) && (currentStep.StepName.ToLower() != "published")) { currentStep = wm.MoveToNextStep(nodo, ""); } } }
But this doesn´t work fine because no select all CMS.File documents in the path. This only select the published files. What´s the problem?? What I need to do to obtain not published files??
Thanks in advance one more time.
|