Example #1
0
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var fileId        = (string)data.Data[FILE_ID];
            var localFilePath = (string)data.Data[LOCAL_FILE_PATH];

            return(OneDriveUtility.DownloadFile(connection, fileId, localFilePath));
        }
Example #2
0
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var folderId     = (string)data.Data[FILE_OR_FOLDER_ID];
            var permissionId = (string)data.Data[PERMISSION_ID];

            return(OneDriveUtility.DeleteResourcePermission(connection, folderId, permissionId));
        }
Example #3
0
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var parentFolderId = (string)data.Data[PARENT_FOLDER_ID];
            var newFolderName  = (string)data.Data[NEW_FOLDER_NAME];

            return(OneDriveUtility.CreateFolder(connection, newFolderName, parentFolderId));
        }
 public static OneDriveBaseResult DeleteResource(GraphServiceClient connection, string fileOrFolderId)
 {
     CheckConnectionOrException(connection);
     return(ProcessRequest(() =>
     {
         OneDriveUtility.DeleteResourceByID(connection, fileOrFolderId);
     }));
 }
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var folderId = (string)data.Data[FILE_OR_FOLDER_ID];
            OneDriveShareType  shareType  = (OneDriveShareType)data.Data[TYPE_OF_LINK];
            OneDriveShareScope shareScope = (OneDriveShareScope)data.Data[SCOPE_OF_LINK];

            return(OneDriveUtility.CreateShareLink(connection, folderId, shareType, shareScope));
        }
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var folderId      = (string)data.Data[PARENT_FOLDER_ID];
            var localFilePath = (string)data.Data[LOCAL_FILE_PATH];
            var fileName      = System.IO.Path.GetFileName(localFilePath);

            return(OneDriveUtility.UploadFile(connection, localFilePath, fileName, folderId));
        }
Example #7
0
        public static OneDriveBaseResult DownloadFile(GraphServiceClient connection, string fileId, string localFilePath)
        {
            CheckConnectionOrException(connection);

            return(ProcessRequest(() =>
            {
                OneDriveUtility.DownloadFilebyID(connection, fileId, localFilePath);
            }));
        }
        public static OneDriveResultWithData <OneDriveFolder> CreateFolder(GraphServiceClient connection, string newFoldeName, string parentFolderId)
        {
            CheckConnectionOrException(connection);
            OneDriveResultWithData <OneDriveFolder> result = ProcessRequest((Func <OneDriveFolder>)(() =>
            {
                var item = OneDriveUtility.CreateFolderById((GraphServiceClient)connection, (string)newFoldeName, (string)parentFolderId);
                return(new OneDriveFolder((DriveItem)item));
            }));

            return(result);
        }
        public static OneDriveResultWithData <OneDriveFolder[]> GetFolders(GraphServiceClient connection, string folderId)
        {
            CheckConnectionOrException(connection);

            OneDriveResultWithData <OneDriveFolder[]> result = ProcessRequest(() =>
            {
                var rawList = OneDriveUtility.GetFolderContentFromId(connection, folderId, ItemType.Folder);
                var list    = rawList.Select((it) => { return(new OneDriveFolder(it)); });
                return(list.ToArray());
            });

            return(result);
        }
        public static OneDriveResultWithData <OneDriveResourceType> DoesResourceExist(GraphServiceClient connection, string fileOrFolderId)
        {
            CheckConnectionOrException(connection);
            OneDriveResultWithData <OneDriveResourceType> result = ProcessRequest(() =>
            {
                DriveItem item = OneDriveUtility.GetResourceInfo(connection, fileOrFolderId);
                if (item.Folder != null)
                {
                    return(OneDriveResourceType.Folder);
                }
                else
                {
                    return(OneDriveResourceType.File);
                }
            });

            if (!result.IsSucceed && result.ErrorInfo.HttpErrorCode == HttpStatusCode.NotFound)
            {
                result.Data      = OneDriveResourceType.Unavailable;
                result.IsSucceed = true;
            }
            ;
            return(result);
        }
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var FolderId = (string)data.Data[PARENT_FOLDER_ID];

            return(OneDriveUtility.GetFiles(connection, FolderId));
        }
        protected override OneDriveBaseResult ExecuteStep(GraphServiceClient connection, StepStartData data)
        {
            var fileOrFolderId = (string)data.Data[FILE_OR_FOLDER_ID];

            return(OneDriveUtility.DoesResourceExist(connection, fileOrFolderId));
        }