Web.CreateAnonymousLinkWithExpiration method
Create an anonymous link which can be used to access a document without needing to authenticate.
Namespace: Microsoft.SharePoint.Client
Assembly: Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)
Syntax
'Declaration
Public Shared Function CreateAnonymousLinkWithExpiration ( _
context As ClientRuntimeContext, _
url As String, _
isEditLink As Boolean, _
expirationString As String _
) As ClientResult(Of String)
'Usage
Dim context As ClientRuntimeContext
Dim url As String
Dim isEditLink As Boolean
Dim expirationString As String
Dim returnValue As ClientResult(Of String)
returnValue = Web.CreateAnonymousLinkWithExpiration(context, _
url, isEditLink, expirationString)
public static ClientResult<string> CreateAnonymousLinkWithExpiration(
ClientRuntimeContext context,
string url,
bool isEditLink,
string expirationString
)
Parameters
- context
Type: Microsoft.SharePoint.Client.ClientRuntimeContext
url
Type: System.StringThe URL of the document in SharePoint.
isEditLink
Type: System.BooleanIf true, the link will allow the guest user edit privileges on the item.
expirationString
Type: System.StringA date/time string that conforms to the ISO 8601:2004(E) complete representation for calendar date and time of day and which represents the time and date of expiry for the anonymous link. Both the minutes and hour value must be specified for the difference between the local and UTC time. Midnight is represented as 00:00:00. For example:
YYYYMMDDThhmmssZ
YYYYMMDDThhmmss±hhmm
YYYYMMDDThhmmss±hh:mm
YYYY-MM-DDThh:mm:ssZ
YYYY-MM-DDThh:mm:ss±hh:mm
YYYY-MM-DDThh:mm:ss±hhmm
A null value indicates no expiry.
Return value
Type: Microsoft.SharePoint.Client.ClientResult<String>
The string for the anonymous link.
Remarks
For more information, see External sharing API for SharePoint and OneDrive for Business.