I had a custom-built tenant-wide SharePoint extension installed and active which was doing a "behind-the-scenes" user authentication (I think through aadHttpClientFactory) that caused any external user to hit a sign-in wall.
SharePoint Online - External Sharing failed: Operation is not valid due to the current state of the object
You can also find this question on SharePoint StackExchange.
The Goal
Share one specific folder in a SharePoint site with an external user (outside of tenant organization) and include Edit permissions without the user needing a Microsoft account.
My Environment
- SharePoint Online
- Admin Center > Policies > External Sharing > Most Permissive/Anyone (See a screenshot here)
- Admin Center > Site > External Sharing > Anyone (See a screenshot here)
- I do have custom code running: tenant wide extensions and web parts. ### Expected and normal behavior
Microsoft confirmed (via my personal ticket) that it is possible to share just one folder to an external user.
I also tested it on another tenant and the external sharing was successful.
Therefore, I know it's something to do with my specific tenant.
The Issue
When I share the folder via "Copy Link" or "Share", after the external user enters the verification code, they can open the folder and it appears just briefly (1/2 seconds), but then the page gets redirected to my organizations' login screen.
When I share the folder via "Manage Access" > "Advanced" > "Grant Permissions":
It won't even let me share it. I get an error within the browser:
Sharing failed: Operation is not valid due to the current state of the object.
The issue occurs on all classic and modern Team and Communication sites.
However, I am able to get it working on one specific classic Team site.
2 additional answers
Sort by: Most helpful
-
Xuyan Ding - MSFT 7,561 Reputation points
2022-04-11T11:35:22.23+00:00 Hi @GC Portal Team ,
I reproduced the issue with my external account. As you say, after the external user enters the verification code, they can open the folder and it appears just briefly , but then the page gets redirected to login interface. My solution is to remove the external user from the Active Directory guest list and then add it manually. There is no such problem when sharing it again. Of course you need to be Global Administrator, and then you could try to solve it in this way.
The specific operations in Active Directory are as follows:
- Active Directory admin center: Users->All users->Select user->Delete user
- New guest user->Invite user->Invite
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
- Active Directory admin center: Users->All users->Select user->Delete user
-
Maciek 80 Reputation points
2024-03-23T10:44:47.31+00:00 Hi @GC Portal Team ,
Here's your problem:
You should change these permissions to "EDIT" and voila.
Cheers.