共享文件夹不会发送电子邮件邀请

时间:2015-11-06 17:09:49

标签: c# sharepoint csom shared-directory

我共享sharepoint文件夹的代码没问题,但它没有向外部用户发送电子邮件邀请。如何在我的代码中添加它?

通过“发送电子邮件邀请”,我的意思是我们可以在SharePoint中找到相同的功能:

enter image description here

代码:

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();

0 个答案:

没有答案