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.0create folder + DotNetNuke.Services.FileSystemcreate folder + DotNetNuke.Services.FileSystem
Previous
 
Next
New Post
7/12/2007 1:51 PM
 

Hello DNN-gurus,

I would like to add an folder programmatically within an module - but I have big problems - hope you can help me:

The idea:
A user, call him "Robert", only sees his own folders -> that's no problem - I use: folders As ArrayList = FileSystemUtils.GetFoldersByUser(PortalId, False, False, "WRITE")Then this user would create a new folder e.g. "TestProject" - I use:

Dim

 

FileSystemUtils.AddFolder(

MyBase.PortalSettings, UserID, "TestProject")

-> doesn't work: I get System.UnauthorizedAccessException {"Access to the path 'TestProject' is denied."} - the user HAS rights to write in this folder structure.

I mean, the folder structure goes like this:

/Portals
/Portals/0 -> for Administrator
/Portals/1 -> User with UserID1
/Poartls/2 -> User with UserID2
/Poartls/3 -> User with UserID3

Imagine that "Robert" has UserID2 - within that folder I would like to add the new one "TestProject" -> hardcoded it means:

/Portals
/Portals/0 
/Portals/1 
/Portals/2
/Portals/2/TestProject 
/Poartls/3

FileSystemUtils.AddFolder(MyBase.PortalSettings, 2, "TestProject") -> no change!

Can you give me a hint or an example how I could do that?

MANY THX for your response and any ideas!!!

Cheers,
Robert


Robert John Austria / Europe
 
New Post
7/15/2007 2:16 AM
 

I am not sure what FileSystemUtils.AddFolder is/does but this works for me -

dim result as string = verifyfolder(System.IO.Path.Combine(PortalSettings.HomeDirectoryMapPath, "TestProject"))

 
If result = “”
 
‘ Do something
 
else
 
‘display error message
 
End if
 
          
Public Shared Function VerifyFolder(ByVal folderPath As String)                   As String
 
            'Returns empty string with success
            If System.IO.Directory.Exists(folderPath) Then
                Return ""
            End If
            Try
                System.IO.Directory.CreateDirectory(folderPath)
                Return ""
            Catch ex As Exception
                Return ex.ToString
            End Try
        End Function
 
New Post
7/16/2007 3:06 PM
 

Hi,

many thanks for your quick answer - it work's :-) !!

Cheers,
Robert


Robert John Austria / Europe
 
New Post
3/26/2009 2:02 AM
 
Hi Steve,

Thanks for this post! I'm trying to use the FileSystemUtils.AddFolder but there are problems with regards to IO Permissions.

 
New Post
3/26/2009 6:06 AM
 

 please make sure, that the ASP.Net account ("Network Service" by default) has full permission to create folders inside your DNN installation subtree.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0create folder + DotNetNuke.Services.FileSystemcreate folder + DotNetNuke.Services.FileSystem


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