static void OutputTeamMemberCsv(TeamMemberAccountModel teamMemberAccount) { // reset & update file name for _csvFile _csvFile = $@"E:\Scratch\dotnetCore_dropbox\csvs\{teamMemberAccount.Email}_dropbox_shares_{_timestampString}.csv"; // reset _csvString for current team member _csvString = ""; // team member details _csvString += _csvTeamMemberAccount.CreateCsvHeaderString(); _csvString += _csvTeamMemberAccount.CreateCsvString(new List <TeamMemberAccountModel>() { teamMemberAccount }); _csvString += Environment.NewLine; // shared folder details foreach (SharedFolderModel sharedFolder in teamMemberAccount.SharedFolders) { _csvString += _csvSharedFolder.CreateCsvHeaderString(); _csvString += _csvSharedFolder.CreateCsvString(new List <SharedFolderModel>() { sharedFolder }); _csvString += Environment.NewLine; // shared folder members _csvString += _csvFolderMemberUser.CreateCsvHeaderString(); _csvString += _csvFolderMemberUser.CreateCsvString(sharedFolder.SharedFolderUsers); _csvString += Environment.NewLine; } _csvTeamMemberAccount.CreateCsvFile(_csvFile, _csvString); }
static async Task <TeamMemberAccountModel> MapTeamMemberAccountDetail(DropboxTeamClient teamClient, string memberId) { if (_debug) { Console.WriteLine("-------------------------------------"); Console.WriteLine("MapTeamMemberAccountDetail() called..."); } TeamMemberAccountModel teamMemberAccount = null; using (DropboxClient userClient = teamClient.AsMember(memberId)) { FullAccount fullAccount = await userClient.Users.GetCurrentAccountAsync(); teamMemberAccount = new TeamMemberAccountModel() { Email = fullAccount.Email, LastName = CheckValueForComma(fullAccount.Name.Surname), FirstName = CheckValueForComma(fullAccount.Name.GivenName) }; } if (_debug) { Console.WriteLine("----------------"); Console.WriteLine($"Email : {teamMemberAccount.Email}"); Console.WriteLine($"LastName : {teamMemberAccount.LastName}"); Console.WriteLine($"FirstName : {teamMemberAccount.FirstName}"); Console.WriteLine($"SharedFolders.Count: going to figure that out next..."); } return(teamMemberAccount); }
static async Task UpdateTeamMemberAccountList(DropboxTeamClient teamClient, string teamMemberId) { if (_debug) { Console.WriteLine("-------------------------------------"); Console.WriteLine("UpdateTeamMemberAccountList() called..."); } TeamMemberAccountModel teamMemberAccount = await GetTeamMemberAccountDetails(teamClient, teamMemberId); OutputTeamMemberCsv(teamMemberAccount); _teamMemberAccounts.Add(teamMemberAccount); }
static async Task <TeamMemberAccountModel> GetTeamMemberAccountDetails(DropboxTeamClient teamClient, string memberId) { if (_debug) { Console.WriteLine("-------------------------------------"); Console.WriteLine("GetTeamMemberAccountDetails() called..."); } TeamMemberAccountModel teamMemberAccount = await MapTeamMemberAccountDetail(teamClient, memberId); List <SharedFolderModel> teamMemberShares = await GetTeamMemberShares(teamClient, memberId); teamMemberAccount.SharedFolders = teamMemberShares; return(teamMemberAccount); }