Web.ShareObject 方法 (ClientRuntimeContext, String, String, String, Int32, Boolean, Boolean, Boolean, String, String)
與外部使用者共用 SharePoint 中的物件,例如文件或網站。
命名空間: Microsoft.SharePoint.Client
組件: Microsoft.SharePoint.Client.Silverlight (在 Microsoft.SharePoint.Client.Silverlight.dll 中); Microsoft.SharePoint.Client.Phone (在 Microsoft.SharePoint.Client.Phone.dll 中)
語法
'宣告
Public Shared Function ShareObject ( _
context As ClientRuntimeContext, _
url As String, _
peoplePickerInput As String, _
roleValue As String, _
groupId As Integer, _
propagateAcl As Boolean, _
sendEmail As Boolean, _
includeAnonymousLinkInEmail As Boolean, _
emailSubject As String, _
emailBody As String _
) As SharingResult
'用途
Dim context As ClientRuntimeContext
Dim url As String
Dim peoplePickerInput As String
Dim roleValue As String
Dim groupId As Integer
Dim propagateAcl As Boolean
Dim sendEmail As Boolean
Dim includeAnonymousLinkInEmail As Boolean
Dim emailSubject As String
Dim emailBody As String
Dim returnValue As SharingResult
returnValue = Web.ShareObject(context, _
url, peoplePickerInput, roleValue, _
groupId, propagateAcl, sendEmail, _
includeAnonymousLinkInEmail, emailSubject, _
emailBody)
public static SharingResult ShareObject(
ClientRuntimeContext context,
string url,
string peoplePickerInput,
string roleValue,
int groupId,
bool propagateAcl,
bool sendEmail,
bool includeAnonymousLinkInEmail,
string emailSubject,
string emailBody
)
參數
url
類型:System.String網站或共用的文件的完整的 URL。範例 ︰
// for sharing a website http://contoso.sharepoint.com/sites/extranet1 // for sharing a document https://contoso.sharepoint.com/sites/extranet1/shared%20documents/mydoc.xlsx
peoplePickerInput
類型:System.StringJSON 的字串格式化資料代表使用者人員選擇器格式。以下是範例,但我們建議您追蹤的 SharePoint 和商務用 OneDrive 的外部共用 API與連結的程式碼範例,瞭解如何產生此物件提供的指導方針。
[{ "Key" : "i:0#.f|membership|somebody.onmicrosoft.com#ext#@somedomain.com", "Description" : "myDomain.onmicrosoft.com#EXT#@somedomain.com", "DisplayText" : "Some Body", "EntityType" : "User", "ProviderDisplayName" : "Tenant", "ProviderName" : "Tenant", "IsResolved" : true, "EntityData" : { "MobilePhone" : "", "Email" : "somebody@myDomain.onmicrosoft.com", "Department" : "", "Title" : "somebody@myDomain.onmicrosoft.com", "PrincipalType" : "GUEST_USER" }, "MultipleMatches" : [] }]
roleValue
類型:System.String若要在物件上授與的權限類型共用角色值。
如果您要共用文件,您必須使用下列的值 ︰
「 角色 ︰ 1073741827 」
「 角色 ︰ 1073741826 」
當您共用網站時,請使用下列格式。從外部使用者將會指定的網站的唯一群組識別碼取代預留位置 {識別碼}。
”group:{groupId}”
groupId
類型:System.Int32若要新增至群組的識別碼。 如果不新增權限群組,請使用零。(目前,會忽略此值)。
propagateAcl
類型:System.Boolean旗標,來判斷權限是否應該推入有專屬權限的項目。
sendEmail
類型:System.Boolean決定旗標如果電子郵件通知應該傳送,如果您設定電子郵件。
includeAnonymousLinkInEmail
類型:System.Boolean如果要傳送電子郵件,這會決定如果匿名連結應該會新增至郵件。
emailSubject
類型:System.String電子郵件的主旨行文字。(目前,會忽略此值)。
emailBody
類型:System.String電子郵件的本文的文字。
傳回值
類型:Microsoft.SharePoint.Client.SharingResult
包含完成指令碼和選擇性的頁面,以重新導向至SharingResult物件。
備註
如需詳細資訊與程式碼範例,請參閱SharePoint 和商務用 OneDrive 的外部共用 API它連結的範例。