private void LoadFolderFromPath(string path = null) { // Update the UI for loading something new ShowWork(true); LoadChildren(new DriveItem[0]); try { OneDriveLib.Browser.ResultItem retItem = Browser.ListFolderFromPath(graphClient, path); Microsoft.Graph.DriveItem parentFolder = retItem.ParentFolder; Microsoft.Graph.DriveItem[] resultsItems = retItem.ChildrenItems; ProcessFolder(parentFolder); string totalMessage = "", strMessage; for (int i = 0; i < resultsItems.Length; i++) { strMessage = String.Format("Name:{0}-----ID:{1}", resultsItems[i].Name, resultsItems[i].Id); if (resultsItems[i].Folder != null) { strMessage = strMessage + String.Format("--FolderChild:{0}", resultsItems[i].Folder.ChildCount); } totalMessage = String.Format("{0}\n{1}", totalMessage, strMessage); } MessageBox.Show(totalMessage); } catch (Exception exception) { PresentServiceException(exception); } ShowWork(false); }
private void MySignIn() { try { graphClient = Browser.SignIn(MsaClientId); } catch (ServiceException exception) { PresentServiceException(exception); } ShowWork(true); LoadChildren(new DriveItem[0]); try { OneDriveLib.Browser.ResultItem resultItem = Browser.ListFolderFromPath(graphClient); Microsoft.Graph.DriveItem rootFolder = resultItem.ParentFolder; Microsoft.Graph.DriveItem[] resultsItems = resultItem.ChildrenItems; ProcessFolder(rootFolder); string totalMessage = "", strMessage; for (int i = 0; i < resultsItems.Length; i++) { strMessage = String.Format("Name:{0}-----ID:{1}", resultsItems[i].Name, resultsItems[i].Id); if (resultsItems[i].Folder != null) { strMessage = strMessage + String.Format("--FolderChild:{0}", resultsItems[i].Folder.ChildCount); } totalMessage = String.Format("{0}\n{1}", totalMessage, strMessage); } MessageBox.Show(totalMessage); UpdateConnectedStateUx(true); } catch (ServiceException exception) { PresentServiceException(exception); } ShowWork(false); }