Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

How to specify sharing link type via csom? #1792

Open
isxaker opened this issue Jun 7, 2018 · 0 comments
Open

How to specify sharing link type via csom? #1792

isxaker opened this issue Jun 7, 2018 · 0 comments

Comments

@isxaker
Copy link

isxaker commented Jun 7, 2018

Hello.

I have an issue with scope specifying for a shared link.
I mean, pnp core allows only following methods, at least now:

CreateAnonymousLinkForDocument() 
ShareDocument() // it's problem that I can't specify scope for link here

But I need to create a link for all people in organization.
Basically, it's possible to achieve by UI.
And I'am also able to specify scope via microsft graph

POST /me/drive/items/{itemId}/createLink
Content-type: application/json

{
  "type": "view",
  "scope": "anonymous"
}

Also I've found a solution which is changing default sharing link type for a tenant
Unfortunately, this solution doesn't work:
(default sharing link type is changed, but shared link is still created for specific people )

Office365Tenant tenant = new Office365Tenant(context.Web.Context);
tenant.LoadAndExecute();
tenant.DefaultSharingLinkType = SharingLinkType.Internal;
tenant.LoadAndExecute();

SharingResult result = context.Web.ShareDocument("https://tenantname.sharepoint.com/Documents/sample.docx", "someone@example.com", ExternalSharingDocumentOption.View,true, "Doc shared programmatically");

Is it possible to specify the type of link being created using csom ?

This question is also available in SO

Category

[ ] Enhancement

Environment

[ ] Office 365 / SharePoint Online

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant