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

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Creating folder programmaticallyCreating folder programmatically
Previous
 
Next
New Post
2/27/2008 1:16 PM
 

I'm trying to create a folder using the AddFolder method, and it doesn't seem to be working. How should I specify the FolderPath parameter (absolute or relative path)? It does add a row to the Folders table, but the actual folder is nowhere to be found. I'm trying to create a folder as a subfolder of the portal root.

 
New Post
3/6/2008 10:33 PM
 

If I recall correctly, the parentFolder parameter should be the path relative to the portal root. Both it and newFolder must NOT have a trailing slash. For example, if you want to create the folder 'MyNewFolder" and the its relative path is "Portals/0/MyFolder/MySubFolder/MyNewFolder", you would use:

FileSystemUtils.AddFolder(PortalSettings, "MyFolder/MySubFolder", "MyNewFolder")

 


Bill, WESNet Designs
Team Lead - DotNetNuke Gallery Module Project (Not Actively Being Developed)
Extensions Forge Projects . . .
Current: UserExport, ContentDeJour, ePrayer, DNN NewsTicker, By Invitation
Coming Soon: FRBO-For Rent By Owner
 
New Post
3/25/2008 3:59 PM
 

I am running into a problem attempting this. I end up with an "Access to path 'MyNewFolder' is denied." Running it in a debug shows the actual exception is from System.UnathorizedAccessException. This behaviour is whether or not I run it with the optional "0" for insecure file system as the location.

My line of code is this:

  FileSystemUtils.AddFolder(Me.PortalSettings(), "ProjectDocuments", txtBoxProjNum.Text(), 0)

ProjectDocuments is a folder under root that has write permissions for all users as of right now, but will be limited to a group that will have write access to this module doing the work and read for all.

txtProjNum is filled with a series of numbers seperated by dashes, 000139-08024-0.

I can add the folder using the file manager just fine, but I need to create a single button sub that will read this project number and create a role (working) followed by a series of folders (stuck on) assign permissions to those folders, and then create a documents module that will eventually be populted by the end-user using the subfolders created by this module. Until I get the folders created I will not really be able to get the permissions worked on...

I have been able to run foldercontroller.addfolder and get the folder listed in the database, but once it tries to sync and realizes the physical folder is not there it dissappears from the database.

I have run the module logged in as host, or not logged in at all with the same results.

Ideas?

 
New Post
3/26/2008 10:57 AM
 

Addition, I am able to run the following code in that place and it works, but then I need to run a couple extra lines to set to FS secure and get the folderid:

  System.IO.Directory.CreateDirectory(Me.PortalSettings.HomeDirectoryMapPath & "ProjectDocuments\" & txtBoxProjNum.Text())

 

 
New Post
6/5/2010 12:37 PM
 
However, reviewing the code of the method AddFolder(), I realized that to create the folder in the file system, never concatenate the physical path of the portal, and try to create in the root of the server ... ah well then its works on this way: FileSystemUtils.AddFolder(Me.Portal, Me.Portal.HomeDirectoryMapPath + If(Me.Portal.HomeDirectoryMapPath.EndsWith("\"), "", "\") + "MyFolder", "NewFolder",0) I hope itls helpsto anybody..... regards...
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Creating folder programmaticallyCreating folder programmatically


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