sharepoint online – CSOM CreateAnonymousLinkForDocument share url link

I am trying to generate Anonymous Share URL link(s) for documents using the following CSOM method:

internal static string GetFileShareUrl(ClientContext spClientContext, string fileRef){
    string fileShareUrl = string.Empty;

    if (spClientContext != null && !string.IsNullOrWhiteSpace(fileRef))
            string fileUrl = GetFileUrl(fileRef); // method to get proper file url format for sharing

            fileShareUrl = spClientContext.Web.CreateAnonymousLinkForDocument(fileUrl, ExternalSharingDocumentOption.View); 
        catch (Exception ex)

    return fileShareUrl;

Where ClientContext is obtained using App Only authenitication:


And is currently throwing the following exception:

Exception thrown: 'Microsoft.SharePoint.Client.ServerException' in mscorlib.dll
Sharing by link is not enabled on the web, site, or tenant.

Spoke with the SharePoint admin and they indicated they enabled sharing for “Only people in your organization”. Is that enough?

If not is based on the following options which would need to be enabled:

enter image description here

Lastly, is there are way to isolate Anonymous Share URL link(s) to a specific site and not entire tenant?