public static async Task RenameAsync(OneDriveStorageItem itemToRename) { try { Shell.Current.DisplayWaitRing = true; string newName = await OneDriveSampleHelpers.InputTextDialogAsync("New Name"); if (!string.IsNullOrEmpty(newName)) { await itemToRename.RenameAsync(newName); } } catch (ServiceException graphEx) { await OneDriveSampleHelpers.DisplayOneDriveServiceExceptionAsync(graphEx); } catch (Exception ex) { await OneDriveSampleHelpers.DisplayMessageAsync(ex.Message); TrackingManager.TrackException(ex); } finally { Shell.Current.DisplayWaitRing = false; } }
/// <summary> /// Create a new folder in the current folder /// </summary> /// <param name="folder">Destination folder where to create the new folder</param> /// <returns>Task to support await of async call.</returns> public static async Task NewFolderAsync(OneDriveStorageFolder folder) { if (folder != null) { Shell.Current.DisplayWaitRing = true; try { string newFolderName = await OneDriveSampleHelpers.InputTextDialogAsync("New Folder Name"); if (!string.IsNullOrEmpty(newFolderName)) { await folder.StorageFolderPlatformService.CreateFolderAsync(newFolderName, CreationCollisionOption.GenerateUniqueName); } } catch (ServiceException ex) { await OneDriveSampleHelpers.DisplayOneDriveServiceExceptionAsync(ex); } finally { Shell.Current.DisplayWaitRing = false; } } }