thumbnail

Most efficient ways to monitor members activities in a Site Collection 

It is well known that SharePoint is a collaboration platform, an environment where files can be stored and shared. Besides this, it offers a well-built management system. 

site collection is part of the SharePoint platform, and its designation is to manage the company’s teams and facilitate communication between departments.

There can be numerous scenarios for which a site collection represents a suitable tool for sharing documents:  

  • communication between company and customer
  • communication between company and partners
  • collaboration between employees that belongs to the same team
  • collaboration between departments: marketing, sales, finance, development etc.

Where it is about shared documents and their management, there it is also about members who can perform actions towards these documents based on their permissions. Among teams of all sizes, there is a constant need of knowing who downloaded or viewed a document, who uploaded or last modified it.

This article is based on means of getting the download history of a document in SharePoint Online. It contains methods of getting logs by using manual settings or by programming. In other words, monitoring actions that take place on library’s items can help in accomplishing objectives and managing company’s needs in a modern way.

 Scenarios 

To create a better image of what monitoring views and downloads for a document means, these examples will accompany what has been described above:

  • As a human resource responsible, you can upload an important document that everybody must read regarding internal regulation. In this case you can see which employee is aware of the company’s internal rules.
  • For managers, there is always a need of setting objectives for a long or short period of time. Having access to the list of team members which acknowledged the plan for the next semester/year is beneficial in knowing which step should be the next one: making effort in informing members regarding the new objectives or start taking actions related to new plan.
  • In case of sharing your intranet with third parties, it is easy and helpful to see if the client accessed the document containing terms and conditions for the renewed contract and so on.  
  • As a site collection administrator, by monitoring actions towards documents, you can notice if a user hasn't been active in a while.  

In Microsoft 365, as a site owner, you can view information about how users interact with your site. The following points describes how to obtain this.

Easy ways for keeping track of views and downloads for the uploaded documents in lists and libraries: 

 1) SharePoint Viewers:  

This point is about a feature that can be enabled by following this path: Site Settings->Manage Site features (under Site Actions group). Site Collection features can be managed by the administrators. With SharePoint Viewers, there is possible to see at a click distance, who viewed or downloaded a file and when. Initially, the site collection administrator can see these details, but it can be controlled whether members see the names of the people who viewed files or pages on a site, by changing the organization-level sharing settings.

The following image describes the immediate effects of enabling the SharePoint Viewers feature. Hovering a file triggers a card that displays last members who viewed or downloaded the file. It contains information as: total number of views as well as unique views, last members which downloaded or just visualized the document. 

poster

To be able to see the entire list, the option is “See details”, that triggers a side panel entitled “File Statistics” that besides the list of viewers, it contains a mini chart that gives an overview of when people were the most active.

poster

2) Site usage: 

In Office 365, a Site Collection owner has access to different types of statistics regarding how users interact with the site. According to Microsoft documentation, site usage offers the possibility to “view the number of people who have visited the site, how many times people have visited the site, and a list of files that have received the most views”. Site admins, owners, members, and visitors can view site usage data. Different statistics can be seen by accessing Site usage section: 

poster

How Site usage can be used:

  • A report can be downloaded, that contains representative data for the selected period of time: last 7, 30, 90 days   
  • This page shows different charts representative for the last 90 days: popular content in the last week, usage insights, time of the day when users are most active on site etc. 
poster

3) Audit logs at site collection level: 

Site collection administrators (site owners) can enable the Reporting feature in SharePoint Online in order to track the user actions on site's content types, lists, libraries, list items and files. This feature can be activated by going to the following path: Site Settings->Site collection features (under Site Collection Administration group). By activating this feature , Audit log reports link becomes available.            

One of the most used functionalities of Audit log reports is Run a custom report option. What can be done is to handpick the events that you want to have in the report as well as the range of time. Filling the form and pressing the button, will download a generated report based on provided data. 

poster

4) Exchange Online module 

The Exchange Online PowerShell V2 enables admins to connect to their Exchange Online environment in Microsoft 365 to retrieve data from the command line. To be able to use Exchange Online cmdlets, the module has to be installed by running the following command:  

Import-Module ExchangeOnlineManagement.

The code sample provided below shows how to get audit logs for a site collection in Office 365: ·        

  • Before using the cmdlets, a connection needs to be established: ­- Connect-ExchangeOnline -Credential $credentialObject      
  • Command Search-UnifiedAuditLog gets very useful parameters: ­  
  • Operations: represents the action type ­  
  • ObjectIds: target documents or files ­  
  • StartDate/EndDate: time range ­  
  • SiteId: the site collection where the ObjectIDs belongs to 
poster

The result of the script can be seen in the console. Each retrieved log object has properties as: creation time, id of user that performed the action and details regarding the document, the library and the site collection.            

Search-UnifiedAuditLog is a simple command that retrieves filtered information that depends on provided parameters. Using cmdlets of this module is not allowed to any user, therefore, Connect-ExchangeOnline is executed successfully, but in case of Search-UnifiedAuditLog an error is displayed: 

Search-UnifiedAuditLog : The term 'Search-UnifiedAuditLog' is not recognized as the name of    a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path         was included, verify that the path is correct and try again.

Solution: Make sure that the user who is connecting to ExchangeOnline is a member of the following group: 

poster

5) Office 365 Management API

The Office 365 Management API provides information about various users, admins, policy actions and events from Office 365 and Azure Active Directory activity logs. As other Azure Apis, the connection to Office 365 Management is based on  the client id and the client secret. The following script shows how to connect to the API in order to get the audit log data. 

poster

The Office 365 Management endpoint receives only two parameters: startDate and endDate, that allows a difference of 24 hours as range of time. Besides, the startDate can only have as value the date from 7 days ago starting with the current date. This solution is not the best alternative, as this endpoint searches through all site collections in the organization. To obtain needed information, results must be filtered programmatically. 

6) Microsoft 365 compliance 

 Compliance audit logs can be accessed by following this path: Office 365 page ->Admin->Compliance-> Audit. First of all, Compliance Audit Logs must be enabled in order to go further. The following image represents a form to which only Office 365 admins can have access. By filling the input fields, a report can be generated as well as downloaded. Activities that can be mentioned are: Deleted file, Accessed file, Downloaded file, Renamed file and so on. 

poster

The result looks as below: 

poster

Conclusion 

This article presented different solutions for getting the audit logs, with a strong accent on event types as “file downloaded” and “file viewed”. The described solutions are only available for SharePoint Online, and can be performed by Office 365 admins or Site Collection owners.

When it comes to programming, the Exhange Online solution is the most efficient one and the strongest reasons are:       

  • good execution time       
  • accepts parameters       
  • easy to use          
  • intuitive

When it comes to manual settings, SharePoint Viewers is the most handy and fast way of having access to actions that users perform towards documents. 

If you want to read more about Office 365 Management APIs, usage data for your SharePoint and, you can check out these articles:

Office 365 Management APIs overview | Microsoft Docs

View usage data for your SharePoint site - SharePoint (microsoft.com)

Search the audit log in the Security & Compliance Center - Microsoft 365 Compliance | Microsoft Docs