How to: Troubleshoot “Failed to enumerate objects in the container. Access is denied”

If you’re trying to change permissions on a folder, including files and subfolders, and you’re getting an error message from Windows saying that it failed to enumerate the objects in the container because access is denied, the following may help you:

  1. Start an elevated command prompt window (hit “CTRL+Q” > type “cmd” in the field > right click and select “Run as the administrator” on “Command Prompt”)
  2. Navigate to the folder that contains the one you wish to change permissions on (in the command prompt, you can use “cd” followed by the name of the folder you wish to access in order to enter that folder).
  3. Once there, type the following (replace the folderName with the actual name of the folder):

takeown /f folderName /r /d y

This command will take ownership of the entire folder and its contents. You can now return to your File Explorer and right-click to set the permissions as you wish.

What do the parameters do?

/f: defines the file or folder name
/r: defines a recursive function (means that all folders and files contained in that folder will also be affected)
/d y: defines a default answer (in this case y=yes), in case the user does not have “list contents”. This means that the user will take ownership even in that case.

We actually are also facing an “Access Denied” error when working with Sitefinity projects that we download from TFS. The usual yellow page displays this error: “UnauthorizedAccessException: Access to the path ‘x:’longpath\App_Data\Sitefinity\Configuration\someDotConfigFile.config’ is denied”. The same “takeown” command helps resolve this issue as well. After running the command, start the IIS manager, right click on the site in the Sites list on the left hand side column, select “Edit Permissions” and then uncheck the option “Read-only”. Hit apply, and the Access Denied error should go away.

MGR: the Intelogist

About MGR: the Intelogist

SharePoint Server developer, turned Sitefinity developer, turned Angular developer, turned SharePoint Online consultant, turned Unily consultant, turned O365 consultant... Never a dull moment!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

This site uses Akismet to reduce spam. Learn how your comment data is processed.