コード例 #1
0
ファイル: MainForm.cs プロジェクト: yoesak/OneDriveAPI
        /// <summary>
        /// Returns all OneDrive items in the first subfolder in the AppFolder
        /// </summary>
        private async void GetFilesInFolderInAppFolderButton_Click(object sender, EventArgs e)
        {
            if (!(OneDriveApi is OneDriveGraphApi))
            {
                JsonResultTextBox.Text = "Only possible when connecting to Graph API";
                return;
            }

            var items = await((OneDriveGraphApi)OneDriveApi).GetAppFolderChildren();

            // Check for a folder in the AppRoot
            if (items != null && items.Collection != null && items.Collection.Any(i => i.Folder != null))
            {
                // Get the first item which is a folder
                var item = items.Collection.First(i => i.Folder != null);

                // Get the items in the folder under the AppFolder root
                var itemsInFolderUnderAppFolder = await OneDriveApi.GetChildrenByParentItem(item);

                JsonResultTextBox.Text = itemsInFolderUnderAppFolder.OriginalJson;
            }
            else
            {
                JsonResultTextBox.Text = "No folder found in the AppFolder root";
            }
        }
コード例 #2
0
        private async void GetByIdButton_Click(object sender, EventArgs e)
        {
            var data1 = await OneDriveApi.GetChildrenByPath("Drivers");

            var data2 = await OneDriveApi.GetChildrenByParentItem(data1.Collection[0]);

            JsonResultTextBox.Text = data2.OriginalJson;
        }