-
Notifications
You must be signed in to change notification settings - Fork 195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot join hub site, because Approval Token is needed #1193
Comments
@mjonila : what permissions did you grant to your Azure AD application? Is the account running the code a site collection admin on the hub site? If not, are you using application permissions? |
We run code in Azure Function. The account running the code is AzureAD application with Application permissions of SharePoint --> Sites.FullControl.All. In the meantime when I do joining to hub site using same AzureAD app with Powershell - it all works!
Maybe PnP Powershell is doing this using CSOM and PnP Core - using REST API and that's the difference ? |
@mjonila : thanks for the details @mjonila . PS uses a Tenant CSOM call (so you have to have full control or be SharePoint Global Tenant admin) whereas in Core we use the REST call like used via the UI. We need to solve this, I'll do some experimentation as there's an option to request the "approval token". Alternatively the CSOM approach can be used but then via a new method hosted in the Admin library |
Thank you for the answer @jansenbe . As I will wait for your testing of getting ApprovalToken using REST, could you please help me find how to join hub site using CSOM ? I cannot find such method in Admin lib, but maybe I'm not looking careful enough .. |
@mjonila : it's not yet wrapped in our Admin lib, but it's available in OOB CSOM. I plan to wrap the CSOM calls and make them available via our Admin library in the course of this week. |
@mjonila : I've added a method to the Admin library that under the covers uses the Tenant hub join API. This one will work also in case joining the hub requires approval. This method however requires administrative privileges to work, but as your PS script works this should work as well. Please test wit next nightly build (version 1.9.73 or higher) and let me know. |
Thanks @jansenbe! It is working now. |
Category
Describe the bug
While using
Ctx.Site.JoinHubSiteAsync(hubSite.Id)
it spits the error :This Hub Site requires approval to join. Please resubmit this request with an Approval Token from the Hub Site admin.
Certainly Hub site options have "Require approval for associated sites to join" enabled.
However I see no way to get Approval Token or enter it somehow into
JoinHubSiteAsync
method. There is PowerAutomate action for getting ApprovalToken, but I don't know how it works.How to fix this problem ?
Steps to reproduce
In Hub site properties enable "Require approval for associated sites to join" and use
JoinHubSiteAsync(hubSiteId)
to join a site into a hub.Expected behavior
Either allow join without token or provide a method to acquire ApprovalToken and feed it into
JoinHubSiteAsync
methodThe text was updated successfully, but these errors were encountered: