SharePoint Online - External Sharing failed: Operation is not valid due to the current state of the object

GC Portal Team 31 Reputation points
2022-04-08T14:04:21.137+00:00

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":
F3cW2.png

It won't even let me share it. I get an error within the browser:
T3IS1.png
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.

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,073 questions
SharePoint Development
SharePoint Development
SharePoint: A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.Development: The process of researching, productizing, and refining new or existing technologies.
2,767 questions
0 comments No comments
{count} votes

Accepted answer
  1. lwsaissmuazusrwwzn 81 Reputation points
    2022-04-19T18:17:48.107+00:00

    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.

    1 person found this answer helpful.
    0 comments No comments

2 additional answers

Sort by: Most helpful
  1. 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:

    1. Active Directory admin center: Users->All users->Select user->Delete user
      191922-screenshot-2022-04-11-183343.png
    2. New guest user->Invite user->Invite
      191895-image.png

    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.

    1 person found this answer helpful.

  2. Maciek 80 Reputation points
    2024-03-23T10:44:47.31+00:00

    Hi @GC Portal Team ,

    Here's your problem:

    User's image

    You should change these permissions to "EDIT" and voila.

    Cheers.

    0 comments No comments