示例#1
0
        public List <CatalogItem> getSubFolder(string path)
        {
            List <CatalogItem> li    = new List <CatalogItem>();
            string             _path = path.Replace("//", "/");

            // Condition criteria.
            SearchCondition[] conditions;

            // Condition criteria.
            SearchCondition condition = new SearchCondition();

            condition.Condition          = ConditionEnum.Contains;
            condition.ConditionSpecified = false;
            condition.Name  = "Name";
            condition.Value = "";
            conditions      = new SearchCondition[1];
            conditions[0]   = condition;


            this._returnedItems = rs.FindItems(_path, BooleanOperatorEnum.Or, conditions);

            // Iterate thro' each report properties to get the path.
            foreach (CatalogItem item in _returnedItems)
            {
                if ((item.Type == ItemTypeEnum.Folder || item.Type == ItemTypeEnum.DataSource) && !item.Name.Equals("/"))
                {
                    if (_path.Length > 1 && item.Path.Substring(_path.Length - 1).LastIndexOf('/') != 0)
                    {
                        li.Add(item);
                    }
                    else
                    {
                        if (item.Path.Substring(_path.Length - 1).LastIndexOf('/') == 0)
                        {
                            li.Add(item);
                        }
                    }
                }
            }
            return(li);
        }
        /// <summary>
        /// Checks the item exist.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="path">The path.</param>
        /// <param name="folderName">Name of the folder.</param>
        /// <returns></returns>
        public bool CheckItemExist(ItemTypeEnum type, string path, string folderName)
        {
            var conditions = new SearchCondition[1];

            conditions[0] = new SearchCondition
            {
                Condition          = ConditionEnum.Contains,
                ConditionSpecified = true,
                Name  = "Name",
                Value = folderName
            };

            _returnedItems = _reportsServerInstance2005.FindItems(path, BooleanOperatorEnum.Or, conditions);

            return((_returnedItems.Where(item => item.Type == type)).Any(item => item.Path == path + "/" + folderName));
        }