CSOM:
https://msdn.microsoft.com/zh-cn/library/office/microsoft.sharepoint.sharing.spdocumentsharingmanager.updatedocumentsharinginfo.aspx
SPDocumentSharingManager 成员
方法:
GetDocumentLink GetRoleDefinitionFromWeb 获取与给定的角色枚举值关联的 web 角色定义。 GetRoleDefinitionIdFromWeb 获取与给定的角色枚举值关联的 web 角色定义 ID。 IsDocumentSharingEnabled 检查文档库中是否已启用文档共享。 SetDocumentLink SetDocumentSharingEnabled 设置是否应在文档库启用文档共享。 UpdateDocumentSharingInfo 包含用作参数以初始化
SPDocumentSharingManager.UpdateDocumentSharingInfo 方法
public static List<UserSharingResult> UpdateDocumentSharingInfo(
string resourceAddress,
List<UserRoleAssignment> userRoleAssignments,
bool validateExistingPermissions,
bool additiveMode,
bool sendServerManagedNotification,
string customMessage,
bool includeAnonymousLinksInNotification
)
参数
resourceAddress
类型:
System.String
URL 指向的可保护对象 (文档、 文件夹或文档库的根文件夹)。
userRoleAssignments
类型:
System.Collections.Generic.List<
UserRoleAssignment>
收件人和为依据来分配这些安全对象上的角色的列表。
validateExistingPermissions
类型:
System.Boolean
additiveMode
类型:
System.Boolean
一个布尔型标志指示的权限设置是否使用加法或严格模式: 真-累加性 ;false — 严格。
sendServerManagedNotification
类型:
System.Boolean
一个标志,指示服务器生成电子邮件通知如果 SharePoint 服务器上配置电子邮件服务器。
customMessage
类型:
System.String
自定义要包括在电子邮件通知中的消息
includeAnonymousLinksInNotification
类型:
System.Boolean
Boolean 标志,用于指示是否包括匿名访问通知邮件中的链接: 真是指包括 ;false 表示不包含。
返回值
类型:
System.Collections.Generic.List<
UserSharingResult>
一个DocumentSharingResult对象,该对象包含用户为每个收件人共享结果
JSOM:
https://msdn.microsoft.com/zh-cn/library/office/jj838523.aspx
SP。Sharing.DocumentSharingManager 对象 (sp.js)
var object =
new SP.Sharing.DocumentSharingManager()
成员
DocumentSharingManager对象具有以下成员。
构造函数
方法
构造函数
DocumentSharingManager对象具有以下构造函数。
构造函数
说明
DocumentSharingManager
Initializes a new instance of the SP.Sharing.DocumentSharingManager object.
方法
DocumentSharingManager对象具有以下方法。
方法
说明
getRoleDefinition
Gets the role definition that is associated with a given Role enum value.
isDocumentSharingEnabled
Checks if document sharing is enabled on a document library.
updateDocumentSharingInfo
Allows a user to update a document's sharing info.
SP.Sharing.DocumentSharingManager.updateDocumentSharingInfo 方法 (sp.js)
注意:其参数与CSOM形式一样
var roleAssignment = new SP.Sharing.UserRoleAssignment();
roleAssignment.set_role(modelObject.CompetenceID);
roleAssignment.set_userId(modelObject.YGUISPAccount);
userRoleAssignments.push(roleAssignment);
SP.Sharing.DocumentSharingManager.updateDocumentSharingInfo(clientContext, modelObject.ResourceAddress, userRoleAssignments, false, false, false, "Please look at the following document", false);
转载请注明原文地址: https://ju.6miu.com/read-1124020.html