/// <summary>
        /// Create a new folder on the reportserver
        /// </summary>
        /// <param name="name">name of the new folder</param>
        /// <param name="parent">The TreeNode onto which the new node will be attached</param>
        /// <returns>The TreeNode that represent the created folder</returns>
        public TreeNode CreateFolder(string name, TreeNode parent)
        {
            try
            {
                RsFacade.CreateFolder(name, parent.ToolTipText, null);
            }
            catch (Exception ex)
            {
                if (!ex.Message.ToLower().Contains("already exists"))
                {
                    throw new Exception(ex.Message, ex);
                }
            }

            var folder = new TreeNode(name)
            {
                Name       = name,
                ImageIndex = 2,
                Tag        = ReportItemTypes.Folder
            };

            if (parent.ToolTipText.EndsWith("/"))
            {
                folder.ToolTipText = parent.ToolTipText + name;
            }
            else
            {
                folder.ToolTipText = parent.ToolTipText + "/" + name;
            }

            parent.Nodes.Add(folder);

            return(folder);
        }
示例#2
0
        private ReportItemDTO CreateFolder(string name, string parent)
        {
            facade.CreateFolder(name, parent, null);
            var folder = facade.ListChildren(facade.BaseUrl, false)
                         .FirstOrDefault(i => i.Name == name && i.Type == ReportItemTypes.Folder);

            Assert.IsNotNull(folder);

            return(folder);
        }