How to share a SharePoint folder with an external user without requiring a Microsoft account

岁酱吖の 提交于 2020-01-05 05:41:10

问题


TL;DR:

How can I programatically share a SharePoint online folder with an external user such that the user only requires an access code and doesn't require a Microsoft account.

Full version: I'm using SharePoint online. I want to share folders within the SharedDocuments list with external users. This is simple from the SharePoint front end - select the folder, choose Share, enter external users email address and select Copy Link.

SharePoint will generate a url which I can send to the external user. The external user visits the url to request an access code to be sent via email. Entering the access code allows the user to access the folder. User doesn't need a Microsoft account. Perfect.

I want to implement this in code (c# and csom). Specifically I want to be able to specify a folder and external email address(s) and retrieve the sharing URL.

I've tried:

Microsoft.SharePoint.Client.Web.CreateOrganizationSharingLink() clientContext.Web.ShareDocument() DocumentSharingManager.UpdateDocumentSharingInfo() WebSharingManager.UpdateWebSharingInformation()

These methods all generate a link - however the link requires a Microsoft account. It's different to the link generated in the UI (above).

Is it possible to generate the access-code only link?


回答1:


You can install this library from Nuget OfficeDevPnP.Core. It includes an extension method for Web object to create anonymous URL.

Usage: string sharedUrl = web.CreateAnonymousLinkForDocument("directUrlToTheItem", ExternalSharingDocumentOption.View);



来源:https://stackoverflow.com/questions/56279481/how-to-share-a-sharepoint-folder-with-an-external-user-without-requiring-a-micro

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!