public File CreateRootUsersFolder(int userID, int portalID) { //create folder FileController ctrl = new FileController(); UserController ctrlUser = new UserController(); UserInfo user = ctrlUser.GetUser(portalID, userID); //create root shared folder File rootPortalFolder = new File(); //rootPortalFolder.ChildCount = 0; rootPortalFolder.CreatedByUserID = userID; rootPortalFolder.CreatedByUserName = user.DisplayName; rootPortalFolder.CreatedDate = System.DateTime.Now; rootPortalFolder.IsInTrash = false; rootPortalFolder.IsFolder = true; rootPortalFolder.ItemType = 0; rootPortalFolder.LastModifiedByUserID = userID; rootPortalFolder.LastModifiedByUserName = user.DisplayName; rootPortalFolder.LastModifiedDate = System.DateTime.Now; rootPortalFolder.Name = "Users Root Folder"; rootPortalFolder.Description = ""; rootPortalFolder.ParentID = GetRootPortalFolder(portalID, userID).ID; rootPortalFolder.PortalID = portalID; ctrl.Create(rootPortalFolder); //add permissions //admins only //update files config FileConfigurationController ctrlConfig = new FileConfigurationController(); var configs = ctrlConfig.GetItems(portalID) as List<FileConfiguration>; configs[0].RootUsersFolderID = rootPortalFolder.ID; ctrlConfig.Update(configs[0]); //unify existing user folders under default users folder foreach (var userFolder in ctrl.GetV702UserFolders(portalID)) { userFolder.ParentID = rootPortalFolder.ID; ctrl.Update(userFolder); } //return default new root users folder return rootPortalFolder; }