Beispiel #1
0
        /// <summary>
        /// Returns all OneDrive items in a folder on another drive that has been shared with the current user
        /// </summary>
        private async void GetChildrenFromOtherDriveButton_Click(object sender, EventArgs e)
        {
            // Retrieve the items shared with the current user
            var sharedWithMe = await OneDriveApi.GetSharedWithMe();

            // Check if any items are shared and if so if there's a shared folder among it
            if (sharedWithMe.Collection.Length == 0)
            {
                JsonResultTextBox.Text = "No items are shared with this user";
                return;
            }
            if (sharedWithMe.Collection.All(item => item.RemoteItem.Folder != null))
            {
                JsonResultTextBox.Text = "No folder is shared with this user";
                return;
            }

            // Take the first folder item shared with the current user and retrieve its children
            var sharedWithMeItem = sharedWithMe.Collection.First(item => item.RemoteItem.Folder != null);
            var data             = await OneDriveApi.GetChildrenFromDriveByFolderId(sharedWithMeItem.RemoteItem.ParentReference.DriveId, sharedWithMeItem.Id);

            JsonResultTextBox.Text = data != null ? data.OriginalJson : "Not available";
        }