apis
78 TopicsWhy isn't there a PowerShell module for OneDrive?
Out of all the various applications that Microsoft produce, OneDrive stands out as an anomaly. Where is the PowerShell module for managing it? Some very simple requirements by developers are simply missing. A very simple one - can I test whether OneDrive is still synchronising and therefore I have to wait before my program/script progresses so that I'm sure we've got the latest versions or won't suddenly get "Cloud provider not running". OneDrive has been around years, this really perplexes me...170Views7likes6CommentsCongratulations, Microsoft products couldn't have been worse even if you tried.
I was thinking why should I bother posting about this, who would read it, and would it make Microsoft any better if someone reads this? But the world would never improve if no one reports this kind of bad design. So here we go. Why make it so hard to sign up for Azure, register an app, set up permissions, register an app in the MDN (whatever the F it stands for), just to be able to connect to build an ETL job that pulls from multi-tenant onedrive. Why so much text everywhere that it becomes unreasonable to read and find information that matters. Why pretend you have an AI called Copilot when it doesn't have access to data and all it does is spit back information from the docs. How to fix this? Put yourself in the shoes of someone new who's integrating Microsoft products for the first time. No assumptions. No required prior knowledge. Less text, straight to the point. No weird error messages with complicated Error IDs. If no one understands them, why bother bloat the limited screen space with it? Why not have an actual AI that can give concrete pointers instead of showing a link to a generic documentation page? This could go on, but I'm gonna practice what I preach and get straight to the point with the suggestions above. The only moat Microsoft has is the heavy corporate contracts that bind stupid corporations to use Microsoft products and services. The moment a new provider with simpler/faster/cheaper services shows up, developers and people working day-to-day with Microsoft services will gladly migrate over. My 2-cent bottle in the sea.159Views4likes2CommentsCannot access the one drive using user email addres (like "/drives/{emailAddress}")
Hi, We were using the Azure Application with special rights to upload a file to user's One Drive using OneDrive API where we identify the drives using user email. We were using the for example /drives/{userEmailAddress}/root:{filePath} to get the file info (see - https://docs.microsoft.com/en-us/onedrive/developer/rest-api/api/driveitem_get), but since 11th of July 2021 that does not work. Only {UserID[GUID]} might be used there and the {userEmailAddress} does not work any more. Question is if this was intended and it will stay like that or it was changed by mistake?1KViews3likes0CommentsSpecial appfolder is sometimes named Graph
Expected or Desired Behavior According to the documentation at https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_get_specialfolder the special appfolder should be named /Apps/{Application Name} Observed Behavior For some users the appfolder is named /Apps/Graph even though the app name is not Graph. For users with the appfolder named Graph the create subscription request fails. The create subscription request for the resource /me/drive/special/approot fails with 503 and the message [Status Code: ServiceUnavailable; Reason: User content migrated. Cannot access disabled item.] Steps to Reproduce This happens for some of our users, but not all. I have been able to reproduce it on one onedrive-user that i have personal access to. Does anyone have any idea how to resolve this? OneDrive is unusable for 50% of our users at the moment.301Views2likes0CommentsAzure App to Read All ODFB External File Share Links for Governance
We have a governance requirement to monitor external sharing from ODFB. We have a script that runs daily to pull down SPO internal sharing activity that previously would include ODFB. We had to add our process account to each ODFB site collection as SCA in order to ready the file sharing metrics. Once sharing metrics were gathered, we would remove the process account as SCA. This caused some issues with ODFB indexing as each change time we change permission, the indexing was impacted. This process is no longer used. I've seen some examples where Azure apps can be granted full control access to SP site collections without user intervention. Is the same possible with ODFB where we could grant an app elevated permission in Azure to inventory sharing links in all ODFB sites?709Views2likes0CommentsOneDrive Account Deletion for iOS
Hello, I'm Ivan. Corresponding to Apple rule : https://developer.apple.com/news/?id=mdkbobfo I'm using MSAL pod in my iOS apps. When logging in to OneDrive, in the application can create account from your SDK. My Question: Can MSAL support account deletion in the SDK since it's required by Apple? Thank you in advance.440Views2likes0CommentsOneDrive direct download link
Hi, We have tried to get direct download link or to access publicly shared drive file with Graph API . It seems that the the URL structure has changed as well as the API. The thing behind the API is that i cant access file though https://graph.microsoft.com/v1.0/shares/{sharedDriveItem-id} this endpoint since when i get the link and try to encode it to get sharedDriveItem-id the response is that the "The sharing link no longer exists, or you do not have permission to access it.". Anyone has any idea how to get direct download URL from initial public share URL give by someone? Thank you.361Views1like1CommentApp Folder is being named "Graph"
There is an issue where the App Folder is being named "Graph" instead of the intended Application Name for some users, specifically those uploading to "my.microsoftpersonalcontent.com." Scenario: 1 A user logs in to the application and OneDrive via OAuth. 2 The user uploads a file to OneDrive. Expected Outcome: The file should be uploaded to /apps/**MyApp**/SomeFile.txt Actual Outcome: The file is uploaded to /apps/**Graph**/SomeFile.txt The upload process utilizes the following special URL: OneDrive API: Get Special Folder https://learn.microsoft.com/en-us/onedrive/developer/rest-api/api/drive_get_specialfolder?view=odsp-graph-online The request is made using: POST https://graph.microsoft.com/v1.0/me/drive/special/approot:/SomeFile.txt:/createUploadSession This returns a URL for posting the upload: https://my.microsoftpersonalcontent.com/personal/XXXXXXX/_api/v2.0/drive/items/YYYYYYYY/uploadSession?guid='XXXXX4-4YYYY-bCCCDDDDDDD'&overwrite=True&rename=False&dc=0&tempauth=d3f4f4f4f4f....133Views1like0CommentsOneDrive 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/answers/questions/1664570/download-issue-401-unauthorized 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://learn.microsoft.com/en-us/answers/questions/1664570/download-issue-401-unauthorized 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/answers/questions/1664570/download-issue-401-unauthorized). 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/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"@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.8KViews1like1Comment