Created
September 12, 2016 17:19
-
-
Save reshmee011/1f08ae19491e5c094986dfdb55f29731 to your computer and use it in GitHub Desktop.
SP.Web.CreateAnonymousLink Method via REST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Test.CreateAnonymousLink = (function() | |
{ | |
var ctx = SP.ClientContext.get_current(); | |
var restSource = _spPageContextInfo.webAbsoluteUrl + "/_api/SP.Web.CreateAnonymousLink"; | |
alert(restSource); | |
$.ajax( | |
{ | |
'url': restSource, | |
'method': 'POST', | |
'data': JSON.stringify({ | |
'url': _spPageContextInfo.webAbsoluteUrl + '/Shared Documents/CRM Dynamics 2015 key.txt', | |
'isEditLink': true | |
}), | |
'headers': { | |
'accept': 'application/json;odata=verbose', | |
'content-type': 'application/json;odata=verbose', | |
'X-RequestDigest': $('#__REQUESTDIGEST').val() | |
}, | |
'success': function (data) { | |
alert(data.d.CreateAnonymousLink); | |
}, | |
'error': function (err) { | |
alert(JSON.stringify(err)); | |
} | |
} | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment