Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Create Folder programmatically DotNetNuke 6Create Folder programmatically DotNetNuke 6
Previous
 
Next
New Post
10/7/2011 7:16 AM
 
Hi all, i've created some modules for dotnentuke 5.x.x and i was able to create folder programmatically in this way:

var folderController = new FolderController();
                    var folderId = folderController.AddFolder(new FolderInfo(this.PortalId, FolderName, (int)FolderController.StorageLocationTypes.InsecureFileSystem, false, false, Null.NullDate));
                    var folder = folderController.GetFolderInfo(this.PortalId, folderId);
                    var permissionController = new PermissionController();
                    var writePermission = permissionController.GetPermissionByCodeAndKey("SYSTEM_FOLDER", "WRITE").Cast<PermissionInfo>().Single();
                    var registeredUserRole = new RoleController().GetRoleByName(folder.PortalID, "Registered Users");
                    folder.FolderPermissions.Add(new FolderPermissionInfo { FolderID = folder.FolderID, PermissionID = writePermission.PermissionID, RoleID = registeredUserRole.RoleID, UserID = Null.NullInteger, PermissionKey = writePermission.PermissionKey, AllowAccess = true });
                    Directory.CreateDirectory(folder.PhysicalPath);
                    FolderPermissionController.SaveFolderPermissions(folder);

But now in DotNetNuke 6 this not work because it seems that duplicate folder permission or something similar. Can anyone tell me how i can create folder programmatically please?

Thanks Marco
 
New Post
10/19/2011 12:01 PM
 
Everytime i ask something in this forum nobody help me... It's frustrating...
 
New Post
10/19/2011 12:36 PM
 
Im not sure why you think noone helps you as based on your post count your only 2 posts are on in this thread so youve never asked any other questions (unless you're logging in as multiple users) - as to the problem if it worked in 5.5.0 and does not now please raise it as an issue at support.dotnetnuke.com. Finally, I had a look at that method signature and in 6.0.1 it shows as deprecated with a suggestion to use FolderController.AddFolder(ByVal folder As FolderInfo)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
New Post
10/20/2011 5:03 AM
 
Solved in this way:

var filterFolderName = FOLDER_NAME;
var folderPath = PathUtils.Instance.FormatFolderPath(PathUtils.Instance.FormatFolderPath(PathUtils.Instance.StripFolderPath("").Replace("\\", "/")) + filterFolderName);

 //Add Folder to Database
FolderManager.Instance.AddFolder(FolderMappingController.Instance.GetFolderMapping(8), folderPath);
FolderManager.Instance.Synchronize(this.PortalId);

I hope this helps someone else..

Marco

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Create Folder programmatically DotNetNuke 6Create Folder programmatically DotNetNuke 6


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out