Пример #1
0
        public void createFolder(string[] folderNames) //, string pfad_gesamt = "", int usernr = -1)
        {
            try
            {
                if (workGroupSession != null)
                {
                    SCBWflFolder subFolder = null;
                    foreach (SCBWflFolder sub in workGroupSession.WorkList.GetSubFolders())
                    {
                        if (sub.Name == folderNames[1]) // => erste Ebene der Ordner
                        {
                            Console.WriteLine("Folder '" + sub.Name + "' (" + sub.ID.ToLong(IDType.wflLocalKey) + ") existiert bereits!");
                            //InfoLogger.WriteFile("update BIG_FOLDER_RESTORE_TMP2 set foldernr = " + sub.ID.ToLong(IDType.wflLocalKey) + " where wgnr = " + usernr + " and pfad_gesamt = '" + pfad_gesamt + "';");
                            subFolder = sub;
                            break;
                        }
                    }
                    if (subFolder == null)
                    {//create Folder erste Ebene
                        subFolder = workGroupSession.WorkList.CreateSubFolder(folderNames[1]);
                        Console.WriteLine("Folder '" + subFolder.Name + "' wurde erstellt!");
                    }

                    if (folderNames.Length > 2)
                    {
                        bool folderExists = false;
                        for (int idx = 2; idx < folderNames.Length; idx++)
                        {
                            folderExists = false;
                            foreach (SCBWflFolder sub in subFolder.GetSubFolders())
                            {
                                if (sub.Name == folderNames[idx])
                                {
                                    subFolder = sub;
                                    Console.WriteLine("Folder '" + sub.Name + "' existiert bereits!");
                                    //InfoLogger.WriteFile("update BIG_FOLDER_RESTORE_TMP2 set foldernr = " + sub.ID.ToLong(IDType.wflLocalKey) + " where wgnr = " + usernr + " and pfad_gesamt = '" + pfad_gesamt + "';");
                                    folderExists = true;
                                    break;
                                }
                            }
                            if (!folderExists)
                            {
                                //create Sub Folders
                                Console.WriteLine("Folder '" + subFolder.Name + "\\" + folderNames[idx] + "' wird erstellt!");
                                subFolder = subFolder.CreateSubFolder(folderNames[idx]);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("createFolder() " + ex.Message);
            }
        }
Пример #2
0
 public SCBWflFolder createFolderInFolder(SCBWflFolder folder, string OrdnerName)
 {
     try
     {
         foreach (SCBWflFolder subFolder in folder.GetSubFolders())
         {
             if (subFolder.Name == OrdnerName)
             {
                 Console.WriteLine("Folder '" + OrdnerName + "' existiert bereits!");
                 return(subFolder);
             }
         }
         if (folder != null)
         {
             return(folder.CreateSubFolder(OrdnerName));
         }
         return(null);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(null);
     }
 }