Expiration Date is null for auto-expiring sharing links in SharePoint Online

Bhargav Prasad 1 Reputation point
2022-03-02T15:14:11.537+00:00

Hi,

We've enabled auto-expiring sharing links for guests on our tenant (30 days). When I share a file/folder with a guest account, I can verify that the sharing link expiration date is set correctly from site permissions pane. However, when I try to fetch items from Sharing links list using REST API, the ExpirationDateTime field returns null in results. Is there another way to fetch the Expiration date using REST API?

Thanks!

Adding some screenshots for reference.

179346-guestaccessexpirationwindow.png

179317-restapiresults.png

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. RaytheonXie_MSFT 40,481 Reputation points Microsoft External Staff
    2022-03-03T06:42:22.883+00:00

    Hi @Bhargav Prasad ,
    Per my test, We can use GetSharingInformation to retrieve Expiration. You can refer to following url

    _api/web/Lists(<guid>)/GetItemById(<itemid>)/GetSharingInformation?$Expand=permissionsInformation,pickerSettings  
    

    It will return all the links and users information. If the url wasn't set Expiration date the property will be null
    179469-image.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



  2. Bhargav Prasad 1 Reputation point
    2022-03-08T12:25:53.92+00:00

    Hi @RaytheonXie_MSFT ,

    I have another follow-up question. I'm now able to fetch sharing links for a specific document using this endpoint. But for our auditing process, we're looking at all external users at a site level with expiring access and then send an email to a mailbox that takes care of extensions or removals. To do this, I will have to query all document libraries / lists on the site and then compile the list of guest sharing links with expiration dates. Is there any way we can query this information from "Sharing Links" list directly? The number of documents that are externally shared will be low compared to the overall file count.

    Happy to elaborate in case of any of the above doesn't make sense.

    Thank you,
    Bhargav


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.