I'm looking to disable the Anonymous links created on my OneDrive for Business site through the REST API I used to delete the Roleassignments for Sharepoint\Reader... or Sharepoint\Writer... which used to disable those VIEW/EDIT links, but that's not anymore. I am now getting special groups


and I am using them to identify that my File's Edit/View link was created.

For disabling the link through REST API I did a POST with X-Http-Method as Delete and it removed the group as well. But the link stayed as is. Only when I disabled it through the UI then I noticed that a special user was unshared


this strange looking Title/LoginName has RoleTypeKind as 255. What exactly does 255 mean? I tried to rely on these special users for the identification of a Public exposure but they don't indicate anything about the type of Public Link they refer to. Any help would be appreciated.

1 Answer 1


You need to use the Web.DeleteAnonymousLinkForObject method to remove/unshare the link for anon users.

Code would be somewhat as below:

var url = _spPageContextInfo.webAbsoluteUrl + "/_api/SP.Web.DeleteAnonymousLinkForObject";
          'url': url,
          'method': 'POST',
          'data': JSON.stringify({
             'url': _spPageContextInfo.webAbsoluteUrl + '/Shared Documents/test.txt',
             'isEditLink': true,
          'headers': {
          'accept': 'application/json;odata=verbose',
          'content-type': 'application/json;odata=verbose',
          'X-RequestDigest': $('#__REQUESTDIGEST').val()
          'success': function (data) {
          'error': function (err) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.