HomeHomeDevelopment and...Development and...DotNetNuke Open...DotNetNuke Open...Problem executing the AddFolders Stored PROCProblem executing the AddFolders Stored PROC
Previous
 
Next
New Post
7/2/2009 5:08 PM
 

DNN5.0.1

I would like to be able to execute the AddFolders stored proc to add my own folders through my webform. I am executing the stored PROC and the record is being created in the folders table, but when I go to the file manager and view the results I end up with folders nested in each other in a very strange way.

If I want to execute that stored proc to create a folder is there other records in other tables that need to be created for the system to work correctly?

Thanks,

John

 
New Post
7/2/2009 5:38 PM
Accepted Answer 

 Hi John,

By calling the stored procedure itself you are utilizing a level that is "too low" and will result in the sorts of headaches you are experiencing.  As an alternative, I strongly recommend taking advantage of the higher-level business classes to interact with the framework.

In this case, to create a new folder, utilize the FileSystemUtils.AddFolder static method.  For example:

        FileSystemUtils.AddFolder(PortalController.GetCurrentPortalSettings(), "myParentFolder", "myNewFolderName")

To create secured or database-secured folders, there is an overload accepting an additional integer.  Use the StorageLocationTypes enumeration to select one of these alternative locations.

Hope this helps!

Brandon 


Brandon Haynes
BrandonHaynes.org
 
New Post
7/2/2009 10:21 PM
 

thanks, that does help.

that is what I was afraid of...I am using XMOD right now, not building my own modules just yet. Is there a way to look through the addfolder code? If I can't make it work I can always have my users create folders manually ahead of time, I was hoping to avoid that.

Eventually, I plan on writing my own modules, but I am not there yet.

Thanks,

John

 
New Post
7/3/2009 6:30 AM
 

 Hi John,

The relevant code is located in Common/Utilities/FileSystemUtilities.vb and Services/FileSystem/FolderController.  The FileSystemUtilities class essentially delegates control to the controller (except for some default permission configuration), so look there to see the bulk of the action.

It does not appear that the controller class is doing anything particularly noteworthy, so it's not impossible that you will be able to reach a satisfactory solution through the stored procedures.  However, these may change at any time in the future making any direct-access solution potentially very brittle.  You may also have some caching issues that make a satisfactory solution possible.

If I were in your shoes, I would open up the Folders table in my database after creating a single folder via the SP and look to see if anything stands out as being especially "wrong" about the data placed therein.  Are the slashes in the correct place?  Is the createdByUserId valid?  Does the path end with a terminating slash?

Because you are interacting with the framework in a highly unusual manner, you'll likely be on your own for the bulk of the debugging work, but hopefully that might get you started.  Best of luck!

Brandon


Brandon Haynes
BrandonHaynes.org
 
Previous
 
Next
HomeHomeDevelopment and...Development and...DotNetNuke Open...DotNetNuke Open...Problem executing the AddFolders Stored PROCProblem executing the AddFolders Stored PROC


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, 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 DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft .NET. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates Snowcovered.com where users purchase third party apps for the platform.