7

We are testing the access request functionality, and are trying to see if there's an option to delete access requests.

We'd like to not have to either approve or reject, but rather delete the requests.

Is this an option?

I'm not seeing this delete option via the browser nor in SharePoint Designer 2013.


07.12.2016 Update >> Found Script Editor Option with button click to bulk delete access requests:

Add following code to script editor webpart:

<script src=" http://sparea.com/sites/assets/include/scripts/1.11.1/jquery-1.11.1.min.js"></script>

<script>
$(document).ready(function() 
{
$("#btnClickDeleteAccessRequests").click(deleteFunction);

function deleteFunction() {

 ExecuteOrDelayUntilScriptLoaded(function(){


   var ctx = SP.ClientContext.get_current(),
   list = ctx.get_web().get_lists().getByTitle('Access Requests'),
   query = new SP.CamlQuery(),
   items = list.getItems(query);
ctx.load(items, "Include(Id)");
ctx.executeQueryAsync(function () {
    var enumerator = items.getEnumerator(),
        simpleArray = [];
    while (enumerator.moveNext()) {
        simpleArray.push(enumerator.get_current());
    }
    for (var s in simpleArray) {
        simpleArray[s].deleteObject();
    }
    ctx.executeQueryAsync();
});   

}, "sp.js");
}});
</script>
<input type="button" id="btnClickDeleteAccessRequests" value=Click Here />
  • Why delete when you can disable access requests? Just curious. – Christoffer Sep 10 '14 at 16:44
  • Great point...project manager idea was to get the access request, but do something with it w/o the requestor getting notification of either an approval or decline action. Our issue is that people can get declined, but almost a "promoted decline" where they were given permission at a folder or library level, rather than at a document level. We're not confident requestors will understand they were rejected for their first "request" but we actually gave them permission at a different level. – Sol Web Solutions Sep 11 '14 at 17:11
  • If someone follows a link directly to a page within a document library to which they do not have access, the Access Request list does not give an option to put them into a group, so this desire to neither Decline nor Accept is very common. However, as Vamshi points out, no custom code is needed. – Keith Hudson Apr 17 '17 at 18:09
10

You don't need to do any custom coding. From browser select the invitation(s) you want to delete and then hit delete button in the keyboard. This is done in SharePoint 2013 on Premise.

  • 1
    okay...that's funny...and scary! You're right though, that works too by just selecting/highlighting the access request and hitting delete! – Sol Web Solutions Mar 17 '17 at 14:58
  • That's really helpful! – Christoffer Feb 7 '18 at 12:48
7

Found a possible work around: I have a load of old access requests in my SharePoint Access Request and Invitations page. I didn't want to decline them as I don't want notification sent to the users (who mostly have access through an AD group) - I'm assuming it would send notifications?

Anyway it appears that the access requests are held in a hidden list, but how to access the access request list, there are three views on it, none of which allow a delete option from the ... menu.

Open the site in SharePoint designer and expand the All Files node. There you will see the Access Requests List. Right click and select Properties.

On the Views panel click New, as you can see I added one called AllItems. Ok everything and go to SharePoint Navigate to the new view, eg yoursite Access%20Requests/AllItems.aspx

The view will have no columns in it so click on the ... next to AllItems and select Modify this View

Add a few columns especially those with edit links The menu now has a delete option

  • Thank you, solution worked for me as well. We are working on SharePoint Office 365 and "withdraw" button is disabled. This workaround helped to delete access requests without notifying the users. – user44637 Jul 29 '15 at 7:58
  • Does anyone know why is the "Withdraw" button disabled? Under what circumstances will the withdraw button be enabled? – Kodeist May 16 '16 at 1:17
  • Withdraw invitation is not for this purpose however it is used for following action: If you want to withdraw an invitation you have sent to an external user, you can revoke the invitation before it is accepted. – Deepika Sep 4 at 11:36
1

In SharePoint Online, you can delete a request from the Access Request list in the browser just by right clicking on the three dot icon next to the requestor's name and choosing the Delete option. Looks like that is an enhancement that has been added in SPO.

  • This allows you to delete them, but only one at a time (even if you select all). Not great for bulk management. – hudsonsedge Feb 12 '17 at 17:23
0

Thank you Sol Web Solutions for the script you were shared, but there are some syntax mistakes with commas and outdated link, which I corrected in this answer.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

<script>
$(document).ready(function () {
$("#btnClickDeleteAccessRequests").click(deleteFunction);

function deleteFunction() {

    ExecuteOrDelayUntilScriptLoaded(function () {

        var ctx = SP.ClientContext.get_current();
        list = ctx.get_web().get_lists().getByTitle('Access Requests');
        query = new SP.CamlQuery();
        items = list.getItems(query);
        ctx.load(items, "Include(Id)");
        ctx.executeQueryAsync(function () {
            var enumerator = items.getEnumerator();
            simpleArray = [];
            while (enumerator.moveNext()) {
                simpleArray.push(enumerator.get_current());
            }
            for (var s in simpleArray) {
                simpleArray[s].deleteObject();
            }
            ctx.executeQueryAsync();
            alert('All requests deleted!');
        });
    }, "sp.js");
}
});
</script>
<input type="button" id="btnClickDeleteAccessRequests" value="Click Here" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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