Try out Dropbox Business endpoints in .NET

// By Stephen Cobbe • Mar 14, 2016

Want to see the Dropbox Business API in action? We've built a .NET sample app that shows you how to link to Dropbox business teams, and use the activity endpoints to get statistics about the members. Check it out in our .NET GitHub repo, here!

This simple dashboard offers a visual overview of some of the team data that Dropbox endpoints expose. Using the Team member file access permission level, data on team information, team daily active users, distinct apps that team members have linked, shared folders with activity in the last week and team member rosters, are retrieved.

Shout-out to Start Bootstrap for the awesome Bootstrap templates!

About the source code

While the sample app includes some placeholder data, you can view data about your specific team by:

  1. adding your app key and secret to the Web.config file in the SimpleBusinessDashboard project
  2. clicking on the 'Connect to Dropbox' button and linking your team to the app

Most of the Dropbox Business API calls are made in the Controllers\HomeController.cs file, including:

Fetching team info: 

DropboxTeamClient client = new DropboxTeamClient(MvcApplication.AccessToken);
 
var teamInfo = await client.Team.GetInfoAsync();
var teamName = teamInfo.Name;
var numMembers = teamInfo.NumProvisionedUsers;

Fetching Activity data: 

ar activityInfo = await client.Team.ReportsGetActivityAsync();
activeUsersToday = (List<ulong?>)activityInfo.ActiveUsers1Day;
/* grab the last element in the array, which contains numDailyActives for today */
var numDailyActives = activeUsers.Last() == null ? 0 : (ulong)activeUsers.Last();
 
var sharedFoldersWeekly = (List<ulong?>)activityInfo.ActiveSharedFolders7Day;
/* grab the last element in the array, which contains numWeeklySharedFolders for this week */
var numWeeklySharedFolders = sharedFoldersWeekly.Last() == null ? 0 : (ulong)sharedFoldersWeekly.Last();

Fetching team member data: 

var memListResult = await client.Team.MembersListAsync();

More info can be found in our .NET SDK documentation.


// Copy link