Esempio n. 1
0
        private static void CreateFolder(string reportingServiceUrl, string folder, string parent)
        {
            try
            {
                var service = new ReportingService2005
                {
                    Url         = reportingServiceUrl,
                    Credentials = System.Net.CredentialCache.DefaultCredentials
                };

                service.CreateFolder(folder, parent, null);
            }
            catch (SoapException ex)
            {
                // Check whether the folder already exists.

                var errorCodeNode = ex.Detail["ErrorCode"];
                if (errorCodeNode == null)
                {
                    throw;
                }
                var errorCode = errorCodeNode.InnerText;
                if (errorCode != "rsItemAlreadyExists")
                {
                    throw;
                }
            }
        }
Esempio n. 2
0
 public void CreateFolder(string folderName, string parentPath)
 {
     try
     {
         _reportService.CreateFolder(folderName, parentPath, null);
     }
     catch (Exception) {}
 }
Esempio n. 3
0
        private void UploadFolder(ReportItem item)
        {
            var exists = HasItem(item);

            if (exists)
            {
                return;
            }

            var parent     = item.Parent;
            var parentPath = parent != null ? parent.Path : "/";

            _Service.CreateFolder(item.Name, parentPath, null);
        }
        /// <summary>
        /// Creates the folder.
        /// </summary>
        /// <param name="folderDestinationPath">The _ folder destination path.</param>
        /// <param name="folderName">Name of the _ folder.</param>
        /// <returns></returns>
        public bool CreateFolder(string folderDestinationPath, string folderName)
        {
            bool resVal;

            try
            {
                _reportsServerInstance2005.CreateFolder(folderName, folderDestinationPath.Replace(@"\", "/"), null);
                resVal = true;
            }
            catch (Exception)
            {
                resVal = false;
            }

            return(resVal);
        }
Esempio n. 5
0
 public string createFolder(string name, string parent)
 {
     try
     {
         //check exist folder
         if (CheckExist(ItemTypeEnum.Folder, parent, name))
         {
             return(String.Format("Folder {0} is already exist", name));
         }
         //create folder
         rs.CreateFolder(name, parent, null);
         return("");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Creates the folder structure of a given path. This will go through each folder in the path and create it.
        /// </summary>
        /// <param name="reportingService">The reporting service.</param>
        /// <param name="path">The path.</param>
        /// <exception cref="System.ArgumentNullException">reportingService</exception>
        private static void CreateFolderFromPath(ReportingService2005 reportingService, string path)
        {
            if (reportingService == null)
            {
                throw new ArgumentNullException("reportingService");
            }

            string [] folders = path.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);

            string parentPath = "/";

            foreach (string folder in folders)
            {
                string folderPath;

                if (parentPath != "/" && parentPath.EndsWith("/"))
                {
                    parentPath = parentPath.Substring(0, parentPath.LastIndexOf("/"));
                }

                if (parentPath == "/")
                {
                    folderPath = parentPath + folder;
                }
                else
                {
                    folderPath = parentPath + "/" + folder;
                }

                if (!ReportingService2005TestEnvironment.ItemExists(reportingService, folderPath, ItemTypeEnum.Folder))
                {
                    reportingService.CreateFolder(folder, parentPath, null);
                }

                if (parentPath != "/")
                {
                    parentPath += "/" + folder;
                }
                else
                {
                    parentPath += folder;
                }
            }
        }
Esempio n. 7
0
 private void EnsureDestDir(string path)
 {
     try
     {
         destRS.ListChildren(path, false);
     }
     catch (Exception)
     {
         //ensure parent folder
         var breatAt = path.LastIndexOf(PATH_SEPERATOR);
         var folder  = path.Substring(breatAt + 1);
         var parent  = path.Substring(0, breatAt);
         if (String.IsNullOrEmpty(parent))
         {
             parent = ROOT_FOLDER;
         }
         EnsureDestDir(parent);
         destRS.CreateFolder(folder, parent, null);
     }
 }
Esempio n. 8
0
        private string CreateTargetLocation(string folderName)
        {
            string[] folders = folderName.Split(new char[] { '/', '\\' });

            string currentLocation = "/";

            foreach (string fld in folders)
            {
                string folder = fld.Trim();
                if (folder.Length == 0)
                {
                    continue;
                }

                string tmpLocation;
                if (currentLocation.Length == 1)
                {
                    tmpLocation = currentLocation + folder;
                }
                else
                {
                    tmpLocation = currentLocation + "/" + folder;
                }
                if (!ItemExists(tmpLocation, ItemTypeEnum.Folder))
                {
                    _rs.CreateFolder(folder, currentLocation, null);
                }
                if (currentLocation.Length == 1)
                {
                    currentLocation += folder;
                }
                else
                {
                    currentLocation += "/" + folder;
                }
            }

            return(currentLocation);
        }
Esempio n. 9
0
        private void CreateFolder(IEnumerable <string> pathParts, string parent)
        {
            var parts = pathParts.ToList();

            if (parts.Any())
            {
                var thisFolder = parts.First();
                try
                {
                    rs.CreateFolder(thisFolder, string.IsNullOrWhiteSpace(parent) ? "/" : parent, null);
                }
                catch (SoapException e)
                {
                    if (e.Detail["ErrorCode"].InnerText != "rsItemAlreadyExists")
                    {
                        throw;
                    }
                }

                CreateFolder(parts.Skip(1), $"{parent}/{thisFolder}");
            }
        }
Esempio n. 10
0
 public void CreateFolder(string Folder, string Parent)
 {
     _proxy.CreateFolder(Folder, Parent, null);
 }
Esempio n. 11
0
 public void CreateFolder(string folder, string parent, string properties)
 {
     webserviceProxy.CreateFolder(folder, parent, null);
 }