Skip to content

How-to guide

How to See Who Viewed a SharePoint Document

Three ways to find out who opened a file in SharePoint Online, what each one really proves, and how we automated it for document reviews.

Written by Osmosys TeamPublished 6 min read

Diagram: three ways to find out who opened a SharePoint document: file card viewers, the Purview audit log, and automated tracking.

Short answer

Use one of two built-in tools. To see names on a file, a site owner turns on the SharePoint Viewers feature, and the names appear on the file card when you point at the file. For a dated record, someone with an audit role searches Microsoft Purview Audit for the Accessed file (FileAccessed) activity, which is kept for 180 days in Audit (Standard). Both record access. Neither proves that the person read the document.

On this page

Which method do you need?

Start with the question you have to answer. Each tool is right for one of these and wrong for the others.

You needUseWho can do it
A quick look at who opened a fileSharePoint Viewers on the file cardA site owner turns it on
Totals for a site, without namesSite usage pageSite owners
A dated record you can exportMicrosoft Purview AuditSomeone with the Audit Logs or View-Only Audit Logs role
A status for each reviewer that updates itselfManagement Activity API with Power AutomateSomeone who can register an app and get admin consent

Method 1: Show viewer names on the file card

This is the simplest option, and it needs no audit role. Viewer names appear only when the setting is on in two places.

Check the organization setting

A SharePoint administrator opens the sharing settings and looks for Let site owners choose to display the names of people who viewed files or pages in SharePoint. Microsoft says it is on by default for the organization.

Turn on the site feature

The feature is off by default for existing sites. A site owner turns it on:

  1. Open the site information pane and select View all site settings.
  2. Under Site Actions, select Manage site features.
  3. Find SharePoint Viewers and select Activate.

After a few minutes, open the document library and point at a file. The file card shows who viewed it. Earlier views appear as well, including any from a period when the feature was switched off.

The site usage page is not a substitute. It reports how many people viewed content, and Microsoft states that individual names appear in the library hover card, not on that page.

Method 2: Search the audit log

Use this when you need to show who opened a file and when.

Before you start

  • You need the Audit Logs or View-Only Audit Logs role in the Microsoft Purview portal.
  • Audit (Standard) keeps records for 180 days. With Audit (Premium), SharePoint records are kept for one year by default.
  • New events are not instant. Microsoft gives no guaranteed time, but says SharePoint records are typically available 60 to 90 minutes after the event.

Search in the Purview portal

  1. Open Audit in the Microsoft Purview portal and start a new search.
  2. Set the date range. The maximum is 180 days.
  3. Under Activities - friendly names, choose Accessed file.
  4. In File, folder, or site, enter the file name or part of its URL.
  5. Run the search, open the job when it finishes, and select Export for a CSV file. Exports hold up to 50,000 rows with Audit (Standard).

Search with PowerShell

For a report you run regularly, use Exchange Online PowerShell. For SharePoint, the object ID is the full URL of the file. The command follows Microsoft’s documentation, so try it on a short date range first.

Connect-ExchangeOnline

Search-UnifiedAuditLog `
  -StartDate (Get-Date).AddDays(-30) `
  -EndDate (Get-Date) `
  -RecordType SharePointFileOperation `
  -Operations FileAccessed `
  -ObjectIds "https://contoso.sharepoint.com/sites/hr/Policies/Leave policy.docx" `
  -ResultSize 5000 |
  ForEach-Object { $_.AuditData | ConvertFrom-Json } |
  Where-Object { $_.UserId -ne "app@sharepoint" } |
  Sort-Object CreationTime |
  Select-Object CreationTime, UserId, Operation, ObjectId, UserAgent

One call returns at most 5,000 results. For more, use -SessionId with -SessionCommand ReturnLargeSet and repeat the command with the same session until nothing comes back.

What a “view” in the audit log really means

Several events look like a view, and they do not mean the same thing. Mixing them up is an easy way to get a report wrong.

EventWhat Microsoft recordsCount it as a view?
FileAccessedA user or system account accessed the file. It is not logged again for the same user and file for five minutesYes, after removing system accounts
FileAccessedExtendedThe same person kept accessing the file, for up to three hoursIt is the same visit, so do not count it again
FilePreviewedA preview. High volumes can come from one action, such as viewing an image galleryNo
FileDownloadedThe document was downloadedReport it separately

Three details from Microsoft’s documentation matter when someone will act on the result:

  • Previews can be logged without anyone looking. Browser prefetch might log a FilePreviewed event, so its presence does not mean the preview appeared on a screen.
  • Intent is not recorded. Microsoft says both events mean that a user’s call led to a read of the file or of its thumbnail, and that the difference between them “isn’t a guarantee of the user’s intent”.
  • Some entries are not people. The user app@sharepoint means that an application performed the action.

So the honest wording in a report is “opened on this date”, not “read”. If you need someone to confirm that they have read and understood a document, ask them to confirm it.

Method 3: Track it automatically

Searching works for one file. It does not work when a policy goes to 40 reviewers and somebody has to chase the ones who haven’t opened it.

We built a proof of concept for this. When a document reaches SharePoint, a Power Automate flow creates one tracking record for each reviewer. A second, scheduled flow collects access events from the Microsoft 365 Management Activity API, matches them to the assigned reviewers, and changes the matching records from Pending to Viewed.

When a document is uploaded

SharePoint libraryDocument added for review
Power AutomateCreates one record per reviewer

On a schedule

Power AutomateScheduled flow
Microsoft Entra IDOAuth 2.0 client credentials
Management Activity APIMicrosoft Purview audit events
MatchAccess events to assigned reviewers

SharePoint tracking list

One record for each reviewer and document

Pendingchanges toViewed

Architecture of the proof of concept

What the API asks for

Register an application in Microsoft Entra ID, have a tenant administrator consent to it, and request a token that carries the ActivityFeed.Read permission. These requests follow Microsoft’s API reference. First, start a subscription to SharePoint events once:

POST https://manage.office.com/api/v1.0/{tenant_id}/activity/feed/subscriptions/start?contentType=Audit.SharePoint&PublisherIdentifier={tenant_id}
Authorization: Bearer {token}

After that, each scheduled run lists the content that became available and downloads it:

GET https://manage.office.com/api/v1.0/{tenant_id}/activity/feed/subscriptions/content?contentType=Audit.SharePoint&startTime=2026-11-23T00:00&endTime=2026-11-23T12:00&PublisherIdentifier={tenant_id}
Authorization: Bearer {token}

Limits to design for

These come from Microsoft’s API reference. Each one shapes the flow.

Documented limitWhat to do about it
The first content can take up to 12 hours to appear after you start a subscriptionStart the subscription the day before you need it
Start and end times can be no more than 24 hours apart, and the start no more than 7 days agoRun at least daily, and alert someone when a run fails
A long list continues in a NextPageUri response headerKeep requesting until the header is absent
Events are not guaranteed to be in orderMatch on the event’s own time, not its position

Two recommendations of our own: let each run overlap the previous one, so a late event is not missed, and make the update safe to repeat, so a record that is already Viewed stays as it is.

How to check that it works

  1. Open a test document with a second account, not the owner’s.
  2. Wait at least 90 minutes before you expect an audit record.
  3. Search for that file and account, and confirm there is a FileAccessed entry with the right time.
  4. Open the same file again within five minutes. No second entry should appear.
  5. If you built tracking, run the scheduled flow twice and confirm that the record changes only once.

If nothing appears after a few hours, check your role, then the date range, then whether the file URL in your search matches the one in SharePoint.

Which one should you choose?

  • One file, out of interest: turn on SharePoint Viewers.
  • A question from management or an auditor: search Purview Audit, and export the result before the retention period ends.
  • Regular reviews with named reviewers: automate it, and keep the word “Viewed” for what it is.

Whichever you use, tell people that access is recorded. Check your company’s policy and local rules on monitoring staff before you share names.

Sources

  1. Allow people to see who views their files or pages, Microsoft Support. Checked 24 November 2026.
  2. Manage sharing settings for SharePoint and OneDrive, Microsoft Learn. Checked 24 November 2026.
  3. View usage data for your SharePoint site, Microsoft Support. Checked 24 November 2026.
  4. Search the audit log, Microsoft Learn. Checked 24 November 2026.
  5. Audit log activities, Microsoft Learn. Checked 24 November 2026.
  6. Learn about auditing solutions in Microsoft Purview, Microsoft Learn. Checked 24 November 2026.
  7. Search-UnifiedAuditLog, Microsoft Learn. Checked 24 November 2026.
  8. Office 365 Management Activity API reference, Microsoft Learn. Checked 24 November 2026.
  9. Get started with Office 365 Management APIs, Microsoft Learn. Checked 24 November 2026.
  10. List of all premium tier connectors, Microsoft Learn. Checked 24 November 2026.

From our work

  • Troubleshooting in Microsoft

    How to Fix SharePoint Access Denied Errors

    Match the exact SharePoint Online message to its cause, find out who can fix it, and solve access denied errors, including when the user already has permission.

    , 8 min read