コード例 #1
0
        private void ExpandListEx(TreeNode node)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                SPList list = (node.Tag as SPList);

                FolderHierarchy.Explorer = this;
                FolderHierarchy.RootNode = node;
                FolderHierarchy.ProcessAllFoldersInList(list);
            });
        }
コード例 #2
0
        private void CopyTemplate(string newFileName, FolderHierarchy driveFolders, FolderHierarchy.Folder newFolder)
        {
            if (string.IsNullOrEmpty(_setting.GoogleTemplatePath))
            {
                return;
            }

            var path = _setting.GoogleTemplatePath.Split('\\');
            var fileName = path[path.Length - 1];

            var parentFolder = driveFolders.Root;
            foreach (var folderName in path.Take(path.Length - 1))
            {
                var driveFolder = parentFolder.FindFolder(folderName);
                if (driveFolder == null)
                {
                    throw new ApplicationException("Couldn't find template to copy. Folder '" + folderName + "' is missing");
                }

                parentFolder = driveFolder;
            }

            var templateFile = parentFolder.FindFile(fileName);
            if (templateFile == null)
            {
                throw new ApplicationException("Couldn't find template to copy. File is missing");
            }

            CopyFile(newFileName, templateFile, newFolder.Id);
        }
コード例 #3
0
        private FolderHierarchy.Folder CreateFolders(IEnumerable<string> folders, FolderHierarchy driveFolders)
        {
            var parentFolder = driveFolders.Root;
            foreach (var folderName in folders)
            {
                var driveFolder = parentFolder.FindFolder(folderName);
                if (driveFolder != null)
                {
                    parentFolder = driveFolder;
                    continue;
                }

                var driveFile = GetExistsFolder(folderName, parentFolder.Id);
                if (driveFile != null)
                {
                    parentFolder = new FolderHierarchy.Folder(driveFile);

                }
            }

            return parentFolder;
        }