files
48 TopicsDisable download but enable printing for excel files
Is it possible to create a permission level that prevents guest users from downloading Excel files while also allowing them to print? I want guest users to be able to print reports from a shared Excel file, but I don't want them to be able to download the file to their devices.200Views2likes4CommentsUrl encoded folder names not decoded on server end
When using the OneDrive API I am url encoding the file names so for example a file with a plus or hash symbol would get encoded the the percent symbol escape sequence. This works correctly for files and they are created on OneDrive with the correct characters. When I create a folder this does not work correctly. I encode the name in the same way but when the folder is created on OneDrive it still contains the percent symbol so it seems not to be decoding server side. Does anyone know how to fix this? ThanksSolved155Views0likes2CommentsNeed to Recover Deleted Files from Local OneDrive Folder on Linux
I mistakenly synced my local OneDrive folder to the remote OneDrive using rclone, intending to update the remote with my local files. However, the sync went the wrong way, and now my local files are gone. Unfortunately, there’s nothing in the remote OneDrive Recycle Bin because all the files were originally on my local machine. I’m working on a Linux system and need to recover the deleted files from my local OneDrive folder. Is there a way to recover these files from the local Recycle Bin or any other method to restore them? Any advice or tools recommended for file recovery on Linux would be greatly appreciated! Thank you!177Views0likes0CommentsOneDrive Files On-Demand copying files to local folder
All, I have a Python script that copies files from a network folder to my server's OneDrive folder and OneDrive is set up to save disk space by using Files On-Demand. So, does that mean any files that I copy to that folder will not take up space on my server's hard drive? Because currently, that is not working? What are some of the possible issues going on with this. I am copying quite a large number of files.211Views0likes0CommentsBase URL used for Multi Tenants
Hello, I want users to select files from their personal and company drive but it requires a base url which is used to authenticate the user into the drive but thecode examplesand thedocsdon't have any indication of where to get a dynamic base url or the base url to use for the multiple tenants. Right now it only works for users in my organisation but I need it for users. Edit: I am using the v8 file picker Thank you3.4KViews1like5CommentsIssue with OneDrive App Folder Creation - Need Assistance
Subject: Issue with OneDrive App Folder Creation - Need Assistance Hello everyone, I am currently facing an issue with OneDrive where it's not creating a folder for my application in the Apps folder of the user's OneDrive root directory when I first invoked the folder using the special folder namespace. I would appreciate any help or suggestions from the community. Here are the steps I've taken so far: I added theFiles.ReadWrite.AppFolderpermission to the application. I have successfully obtained the token. I attempted to use the API to create my app's folder, but unfortunately, it failed. I have attached a screenshot for reference (Please see the attachment below). As a reference, I have been following this Knowledge Base article:Creating your app's folder in OneDrive I'm not sure why the app folder creation is not working as expected. If anyone has encountered a similar issue or has any suggestions, I would be grateful for your input. Thank you in advance for your help! Best regards, Leo287Views0likes0CommentsOneDrive lost my files
Yesterday I lost all my files on OneDrive I lost my connection to OneDrive for unknown reasons - it just happened. When I then tried to access my OneDrive files via the browser, I found that all my files were gone. I have tried to contact Microsoft and all I get is someone on the chat that can only help with problems from my end. This is not my problem or a problem with my device, it is problem at Microsoft end. I was advised to try this forum, so I hope you can give me some advice. Thanks299Views0likes0CommentsOneDrive download issue: 401 Unauthorized
Hello, I'm Nick. Our team built a WordPress plugin written in PHP that integrates OneDrive as a remote storage solution. Recently, some users have reported issues downloading backups from OneDrive. To connect OneDrive, users need to authenticate their accounts. Here are the authorization codes used in the process. Once authentication is complete, the plugin retrieves the following information: access_token, refresh_token, and expires_in. $auth_id = uniqid('wpvivid-auth-'); $url = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize' . '?client_id=' . urlencode('37668be9-b55f-458f-b6a3-97e6f8aa10c9') . '&scope=' . urlencode('offline_access files.readwrite') . '&response_type=code' . '&redirect_uri=' . urlencode('https://auth.wpvivid.com/onedrive_v2/') . '&state=' . urlencode(apply_filters('wpvivid_get_admin_url', '') . 'admin.php?page='.sprintf('%s-remote', apply_filters('wpvivid_white_label_slug', 'wpvivid')).'&action=wpvivid_pro_one_drive_finish_auth&sub_page=cloud_storage_onedrive&auth_id='.$auth_id) . '&display=popup' . '&locale=en'; header('Location: ' . esc_url_raw($url)); Fortunately, uploading to OneDrive seems to be functioning properly. We followed the official OneDrive documentation below to ensure a smooth upload process. https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_createuploadsession?view=odsp-graph-online According to the doc, create an upload session to upload files to OnDrive. Here are the code snippets: $url='https://graph.microsoft.com/v1.0/me/drive/root:/'.$path.':/createUploadSession'; $args['method']='POST'; $args['headers']=array( 'Authorization' => 'bearer '.$this->options['token']['access_token'],'content-type' => 'application/json'); if(!is_null($body)) { $args['body']=$body; } $args['timeout']=30; $response=wp_remote_post($url,$args); The session URL returned in the response: https://my.microsoftpersonalcontent.com/personal/9fc61e00e002d0e3/_api/v2.0/drive/items/01AMXTOQ72H2ZYXNPRNZG2CAID634ROO4L/uploadSession?guid='b67d7587-1201-45e3-8fb5-5285cdc08012'&overwrite=True&rename=False&dc=0&tempauth=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBfZGlzcGxheW5hbWUiOiJHcmFwaCIsImFwcGlkIjoiMDAwMDAwMDMtMDAwMC0wMDAwLWMwMDAtMDAwMDAwMDAwMDAwIiwiYXVkIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwL215Lm1pY3Jvc29mdHBlcnNvbmFsY29udGVudC5jb21AOTE4ODA0MGQtNmM2Ny00YzViLWIxMTItMzZhMzA0YjY2ZGFkIiwiY2FjaGVrZXkiOiIwaC5mfG1lbWJlcnNoaXB8MDAwMzdmZmVhZjdmNjJjZkBsaXZlLmNvbSIsImNpZCI6IlR2d0I2WWsrbVVHNzhKNDN3MzM3dXc9PSIsImVuZHBvaW50dXJsIjoiUk4vUUtFTDlYa2ZuTFF0Z1VFMHdTajNGTkdjUEVzMDh5Y2t2V3ZnL1BuYz0iLCJlbmRwb2ludHVybExlbmd0aCI6IjIxMyIsImV4cCI6IjE3MTUxNDk0MjgiLCJpcGFkZHIiOiI1Mi4xMDQuMTQxLjE3MCIsImlzbG9vcGJhY2siOiJUcnVlIiwiaXNzIjoiMDAwMDAwMDMtMDAwMC0wZmYxLWNlMDAtMDAwMDAwMDAwMDAwIiwibmJmIjoiMTcxNTA2MzAyOCIsInB1aWQiOiIwMDAzN0ZGRUFGN0Y2MkNGIiwic2NwIjoibXlmaWxlcy5yZWFkIGFsbGZpbGVzLndyaXRlIGFsbHByb2ZpbGVzLnJlYWQiLCJzaWQiOiIxMjM5ODY3MzA2MzQyMDg1MzQ0MV8zNzY2OGJlOS1iNTVmLTQ1OGYtYjZhMy05N2U2ZjhhYTEwYzkiLCJzaXRlaWQiOiJZamhoT1dJMFpUa3RZV1JrTlMwME56azRMV0l3WmpFdFkyWmlNMlZrWmpnM01UUTAiLCJ0aWQiOiI5MTg4MDQwZC02YzY3LTRjNWItYjExMi0zNmEzMDRiNjZkYWQiLCJ0dCI6IjIiLCJ1cG4iOiJhYUBhbHBoYWxlZ2FjeWZ1bmQub3JnIiwidmVyIjoiaGFzaGVkcHJvb2Z0b2tlbiJ9.JrXt2RbvfhrrVne77PHfAsbNAPEcu5bf61402gXv2Po Utilize the session URL provided in the response to upload files: $curl = curl_init(); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $upload_size=min($upload_size,$file_size-$uploaded); if ($uploaded) fseek($file_handle, $uploaded); $headers = array( "Content-Length: $upload_size", "Content-Range: bytes $uploaded-$upload_end/".$file_size, ); $options = array( CURLOPT_URL => $url, CURLOPT_HTTPHEADER => $headers, CURLOPT_PUT => true, CURLOPT_INFILE => $file_handle, CURLOPT_INFILESIZE => $upload_size, CURLOPT_RETURNTRANSFER=>true, ); curl_setopt_array($curl, $options); $response=curl_exec($curl); Continue uploading file chunks using the 'nextExpectedRanges' provided in the response until the entire file is uploaded. We attempted to download the backup from OneDrive following the official documentation (https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get_content?view=odsp-graph-online). Unfortunately, the download process failed. Before proceeding, check if the file exists. Here's the code snippet for this step: $url='https://graph.microsoft.com/v1.0/me/drive/root:/'.$folder.'/'.$file.'?$select=id,name,size'; if(empty($except_code)) { $except_code=array(200,201,202,204,206); } $args['timeout']=$timeout; $args['headers']['Authorization']= 'bearer '.$this->options['token']['access_token']; $response=wp_remote_get($url,$args); The '$url' in the code snippet is https://graph.microsoft.com/v1.0/me/drive/root:/wpvividbackuppro/staging_untetheredbytinapayne_com/staging.untetheredbytinapayne.com_wpvivid-6639c8da6e73b_2024-05-07-01-23_backup_all.zip?$select=id,name,size '$args' parameter is {"timeout":30,"headers":{"Authorization":"bearer EwBoA8l6BAAUbDba3x2OMJElkF7gJ4z/VbCPEz0AAWP+nK+LDe9/gYinyOb9qXXwzcaMDpHlUCFgxpDiym9czdVDbAArgwmsGI+c+DqAyzgGEBf/QZ1hVSS/hFsPELNYdMwD8orcS+iadcYsRyOjIYA48NK6RVifg5VsQwLQvFOP/jO9Ho0mw17UoRrylJwNZ3uglKr4wL22Z1twPERWaBpdxaz1z2GHfZU+00HIL+QycgVLbQ+wvOrn6SZUVCAWQK+mPTy9hSFyZoitS1lGmUsKZ6D7ml9/5/FyVvVtXHt5nIGi9e2cdsRVy5XiXtbAuGz871TvBtCdgKE0n5Lj2JN/lKR/bEe4CjhkuttbrpBTP55l4ERb0/Ko5p8Od5MDZgAACH7rqvHkxM3OOAKgg4cMahuo1N0WkRW15qY1PgclkSaSBE6NEgecql5Koz+iUhBh457B7/dpyxncun89KFIoOZpxZn8WPY3epTqfFRLu1iSx1BgAB5sNqXC3Iqpsv5VpcHiySTwlctJHbbnHoEl8WVDRQgWxyjgQyXgEFV1u1kwvpywLZH6KRc++EV0/Axg9XnrW01xEI/0emiFndAmnSYnQ0meAjIXC3LDym+2KNUd05xF9dAeuW5lCJ+/tlpkPfcOY0uJhOMFHDaNCw7H6r/MhQGhHQVZeUm1NUCDi94RZ7xhNB0rDuI0PTKEWFcfR2TGQ/y/m+mYKikx0vsp/kFNp2QtIIbZL+JfvhB1b9n3ZlLT2j3fvZ6UNp5gODRzXLYeq8Wk3q+rFsJ4gG+2S3wqkjwyoB7muUbSWpHWXaFtVLu8RtTuoiu2YykfBy5M9+R0cCbeQ45P2ipD+ZK5WbIY0eUrRY+cPJ/K17UxcLBBTeCftJRW9KgYP1sFtfda1SXOm8PC5JW4YTP/AWcRmvqAIKaXJPKn92ZfBTlWQxxQNRxpJf8enPhl9p8+dj/sJx7M3vcCIUfXKtWt6LJld6ywI13oiSj0NZq3fPARJlrQvja5Z4Td55iW+oHIBKgOMzPCzxKXbSQ2O5mc3jYcY9iOewvehRF/fPS93aWyePaxApiWQ0bP13PqNTOBLWtzse1r1xQymF4B7FltTBrjVcV9PduAMe3u/bSewaQEf4Xgldv+KavdS8mDd+0ctRhV554YCcwI="}} The request response is {"headers":{},"body":"{"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('aa%40alphalegacyfund.org')/drive/root(id,name,size)/$entity","@odata.etag":"\"{8BB33EFA-F1B5-4D6E-A101-03F6F9173B8B},3\"","id":"9FC61E00E002D0E3!s8bb33efaf1b54d6ea10103f6f9173b8b","name":"staging.untetheredbytinapayne.com_wpvivid-6639c8da6e73b_2024-05-07-01-23_backup_all.zip","size":78335490}","response":{"code":200,"message":"OK"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} After confirming the file exisitance, start downloading files. Here are the codes snippet: $url='https://graph.microsoft.com/v1.0/me/drive/root:/'.$path.'/'.$download_info['file_name'].':/content'; $headers['Range']="bytes=$downloaded_start-$downloaded_end"; $response=$this->remote_get($url,$headers,false,30); The '$url' in the code snippet represent: https://graph.microsoft.com/v1.0/me/drive/root:/wpvividbackuppro/staging_untetheredbytinapayne_com/staging.untetheredbytinapayne.com_wpvivid-6639c8da6e73b_2024-05-07-01-23_backup_all.zip:/content $args parameter is {"timeout":30,"headers":{"Authorization":"bearer EwBoA8l6BAAUbDba3x2OMJElkF7gJ4z/VbCPEz0AAWP+nK+LDe9/gYinyOb9qXXwzcaMDpHlUCFgxpDiym9czdVDbAArgwmsGI+c+DqAyzgGEBf/QZ1hVSS/hFsPELNYdMwD8orcS+iadcYsRyOjIYA48NK6RVifg5VsQwLQvFOP/jO9Ho0mw17UoRrylJwNZ3uglKr4wL22Z1twPERWaBpdxaz1z2GHfZU+00HIL+QycgVLbQ+wvOrn6SZUVCAWQK+mPTy9hSFyZoitS1lGmUsKZ6D7ml9/5/FyVvVtXHt5nIGi9e2cdsRVy5XiXtbAuGz871TvBtCdgKE0n5Lj2JN/lKR/bEe4CjhkuttbrpBTP55l4ERb0/Ko5p8Od5MDZgAACH7rqvHkxM3OOAKgg4cMahuo1N0WkRW15qY1PgclkSaSBE6NEgecql5Koz+iUhBh457B7/dpyxncun89KFIoOZpxZn8WPY3epTqfFRLu1iSx1BgAB5sNqXC3Iqpsv5VpcHiySTwlctJHbbnHoEl8WVDRQgWxyjgQyXgEFV1u1kwvpywLZH6KRc++EV0/Axg9XnrW01xEI/0emiFndAmnSYnQ0meAjIXC3LDym+2KNUd05xF9dAeuW5lCJ+/tlpkPfcOY0uJhOMFHDaNCw7H6r/MhQGhHQVZeUm1NUCDi94RZ7xhNB0rDuI0PTKEWFcfR2TGQ/y/m+mYKikx0vsp/kFNp2QtIIbZL+JfvhB1b9n3ZlLT2j3fvZ6UNp5gODRzXLYeq8Wk3q+rFsJ4gG+2S3wqkjwyoB7muUbSWpHWXaFtVLu8RtTuoiu2YykfBy5M9+R0cCbeQ45P2ipD+ZK5WbIY0eUrRY+cPJ/K17UxcLBBTeCftJRW9KgYP1sFtfda1SXOm8PC5JW4YTP/AWcRmvqAIKaXJPKn92ZfBTlWQxxQNRxpJf8enPhl9p8+dj/sJx7M3vcCIUfXKtWt6LJld6ywI13oiSj0NZq3fPARJlrQvja5Z4Td55iW+oHIBKgOMzPCzxKXbSQ2O5mc3jYcY9iOewvehRF/fPS93aWyePaxApiWQ0bP13PqNTOBLWtzse1r1xQymF4B7FltTBrjVcV9PduAMe3u/bSewaQEf4Xgldv+KavdS8mDd+0ctRhV554YCcwI=","Range":"bytes=0-2097151"}} The request response is 401 Unauthorized {"headers":{},"body":"{"error":{"code":"unauthenticated","message":"Unauthenticated"}}","response":{"code":401,"message":"Unauthorized"},"cookies":[],"filename":null,"http_response":{"data":null,"headers":null,"status":null}} Our plugin automatically checks for token expiration in every request. If a token is expired, it's refreshed to ensure uninterrupted service. We've carefully followed the OneDrive Learn Documentation for both uploading and downloading files in our plugin. However, we're consistently encountering a 401 Unauthorized error during the download process. Any insights or suggestions on resolving this issue would be greatly appreciated.1.2KViews1like1CommentPermissions removal propogated to children with unique permissions but not in delta
2 issues: When a user is remove from a folder, it propagates to children with unique permissions The permission changes on the children are not reflected in the delta query when calling a deltaLink got from previous run. Minimal rerpo for permission not being available in delta url: Create a folder and a file within it Add/Remove permission from child file to make it have unique permission Add a user to the parent folder Call /delta and get delta.nextLink Remove permission from parent folder Call link got from delta.nextLink (you'll see the child file is not present even though the permissions for it was changed) The delta url is called with Prefer: deltashowremovedasdeleted,deltatraversepermissiongaps,deltashowsharingchanges,hierarchicalsharing header as suggested in the docs both the times. The problem only happen on the first the user is deleted and work on subsequent deletions. Question also posted at https://learn.microsoft.com/en-us/answers/questions/1682649/permissions-removal-propogated-to-children-with-un256Views0likes0Comments