HubSiteUrl not being set with delegated permission #897
Replies: 3 comments 1 reply
-
OK after adding a MessagesDelegate property to the call I now get this warning: You need to be a SharePoint admin when associating to a Hub site. The delegated user has the Sharepoint Administrator role in AAD and is also part of the Site Collection Administrator group for the site. Is this referring to some other property/role/setting? Thanks! Oliver |
Beta Was this translation helpful? Give feedback.
-
1 year later, I've struck the same thing with the same setup, except with application permissions instead of delegated. I have found the following check is responsible: var adminSiteUrl = clientContext.Web.GetTenantAdministrationUrl();
try
{
// Connect to the Admin Site
using (var adminContext = clientContext.Clone(adminSiteUrl))
{
// Do something with the Tenant Admin Context
Tenant tenant = new Tenant(adminContext);
tenant.EnsureProperty(t => t.RootSiteUrl);
// If we've got access to the tenant admin context,
// it means that the currently connecte user is an admin
return (true);
}
}
catch
{
// In case of any connection exception, the user is not an admin
return (false);
} This fails 401, falling into the catch block. @oliver-tbs appreciate it's been a while so no worries if not, but did you ever manage to resolve this and do you recall how? |
Beta Was this translation helpful? Give feedback.
-
Hi Jake, Thanks for the additional information! We solved the issue by calling the JoinHubSite api. Where the following objects are given: ClientContext ctx
|
Beta Was this translation helpful? Give feedback.
-
Hello,
I have an Azure function app that calls the ApplyProvisioningTemplate method to apply a template file to a Web object. I use a parameter field to set the value of HubSiteUrl in the WebSettings section of the template.
The value is set correctly when using SharePoint API permission of type Application (Sites.FullControl.All). However, the value is not set when using permission of type Delegated (AllSites.FullControl).
Any idea why this happens?
Thanks!
Oliver
Beta Was this translation helpful? Give feedback.
All reactions