I was trying to use MS365 For each file or folder activity but showing share access denied even though SharePoint can be read or edit from browser, paths have been correctly provided and only for this particular activity its showing error, for the activity find files and folders its working well but since drive item is restricted to only 200, I have to use MS365 For each file or folder activity. Please share if anyone has addressed this similar issue while SharePoint automation. Thank You!!
Please find the error message
For Each file or folder: Code: accessDenied
Message: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
Inner error:
Code: sharesAccessDenied
ClientRequestId: 4e865cb1-4dfd-4f06-fds98-9458a33e754a
AdditionalData: @onedrive.linkFeatures:
Thank you so much for your reply, but my other query was with the same SharePoint link and Application Secret Id, I was able to use Find Files and Folder activity, and it provided me 200 drive items of the same subfolder. Does Permission vary from activity to activity.
Yes, that was my understanding it does not vary from activity to activity, but still i have given for review to my admin to recheck if permissions are missing. Sure, please see the configuration of the activity and let me know if i need to correct. Thank You!!
Thank you so much I tried what you have suggested, and it is working with specific url and I am able to retrieve the drive item using the specific url. But the issue with specific url is my folder names are dynamic and i have to check different subfolders. So, when i copying specific URL from my Browers it is giving values for me, but creating URL by myself seems not working because SharePoint URL which we copy browser is different with what we create for example
Hello I have a similar problem i have no probleme with the find file or folder but i have an acces denied for the for each file.I want to switch since apparently the activity finis obsolete after 2.7.21
Here a screenshot, the main difference with @Rakesh_Ravinathan_Beena is that i use certifact to autentify. I don’t use account Id since it work without it for find file and i don’t really understand what id is needed for this parameter
For your access denied issue, lets try with minimal queries in there.. Most likely folders you are trying to search is not available at the path you have provided. Please note that simple search doesn;t work on subfolders, only immediate folders list.
And you can’t use advanced search functionality with auth method as app id and secret.
This error happens because the MS365 “For Each File or Folder” activity uses Microsoft Graph API, which requires stricter permissions than browser access.
Make sure the account in MS365 Scope has Sites.Read.All or Sites.ReadWrite.All in Azure AD.
Use the correct DriveItem path, e.g., /Shared Documents/FolderName, not the full site URL.
Check folder permissions; some may block Graph API even if browser access works.
For large folders, the activity may fail due to Graph API limits.
A workaround is to use Find Files and Folders to get the list, then iterate with a standard For Each loop.