Created
August 12, 2014 06:03
-
-
Save chakkaradeep/fc2349a5b8597786df2a to your computer and use it in GitHub Desktop.
Office 365 API My Files - Get All Files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task<ObservableCollection<MyFile>> GetMyFiles() | |
{ | |
ObservableCollection<MyFile> myFilesList = new ObservableCollection<MyFile>(); | |
var filesResults = await _spFilesClient.Files.ExecuteAsync(); | |
var files = filesResults.CurrentPage.OfType<Microsoft.Office365.SharePoint.File>().ToList(); | |
foreach (var file in files) | |
{ | |
MyFile myFile = new MyFile(); | |
myFile.Id = file.Id; | |
myFile.Name = file.Name; | |
myFile.ContentStream = await GetFileContent(file.Id); | |
myFilesList.Add(myFile); | |
} | |
return myFilesList; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment