我共享sharepoint文件夹的代码没问题,但它没有向外部用户发送电子邮件邀请。如何在我的代码中添加它?
通过“发送电子邮件邀请”,我的意思是我们可以在SharePoint中找到相同的功能:
代码:
Folder folderToShare = web.GetFolderByServerRelativeUrl(urlDestination);
var role = clientContext.Web.RoleDefinitions.GetByType(RoleType.Editor);
var roleBinding = new RoleDefinitionBindingCollection(clientContext) { role };
folderToShare.ListItemAllFields.BreakRoleInheritance(true, false);
User user = web.EnsureUser("my email adress here");
folderToShare.ListItemAllFields.RoleAssignments.Add(user, roleBinding);
clientContext.ExecuteQuery();