Mircrosoft Graph API: List all DriveItems in a drive : badRequest - microsoft-graph-api

I am getting the drive of my sharepoint using the following which returns the drive and its ID etc
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com:/sites/mysite:/drive
However the below call returns a "Bad Request, url specified is invalid". Has anyone got any ideas on what I am doing wrong?
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com:/sites/mysite:/drive/items

You can get the root folders like this
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com/sites/mysite/drive/root/children
Note that mysite/drive is the default drive.
You can use
GET https://graph.microsoft.com/v1.0/sites/mycompany.sharepoint.com/sites/mysite/drives/{driveId}/root/children
to identify the specific driveId.
There's no endpoint to get all items in a drive with every file from every subfolder at once.
Here is a similar question for your reference.

Related

In Sumo Logic, how do I get a list of folders off the root folder?

Using the Sumo Logic API, /api/v2/content/folders/{id} works and gives me the parentId. hitting the same endpoint for a folder off the root folder gives a parentId. however hitting the same endpoint with that id errors with "Content with the given ID does not exist."
When I hit /api/v2/folders/global it returns an id. every time I hit the endpoint it gives me a different id. trying to use any of those ids at /api/v2/content/folders/{id} also gives the error "Content with the given ID does not exist."
I'm trying to write a script that will return the Sumo Logic ID of a folder from a user-defined path. e.g. get_sumo_id -p "/products/someapp/monitoring"
Figured it out. I hadn’t read the docs well enough. The id returned from /api/v2/folders/global is a job id, not a folder id. You wait until it's done and check for success using /api/v2/folders/global/<job id>/status. if successful you can retrieve /api/v2/folders/global/<job id>/result.

Microsoft graph API: /me/drive/root/search - no path to found file

I have problem with graph API. I'm making search component in React. Of course there can be many files with same name so I need to display path to it also. Problem is with this endpoint:
https://graph.microsoft.com/v1.0/me/drive/root/search(q='book')
I noticed that when I'm searching for all drive elements I receive path to file. But when I'm using /me/drive endpoint to search for only my files there is no path in parentReference.
The only option to get path is making second request:
https://graph.microsoft.com/v1.0/me/drive/items/{parent_reference_id}
Is there any solution for this? I tried expanding parentReference but it's saying that it's not supported.
When ever you try to get the path of an item you can use the /Items/{itemId} endpoint that gives the ParentReference property with the path in it.
https://graph.microsoft.com/v1.0/me/drive/Items/{Itemid}
In your case as you are searching for book file, pull the id from there and use the above query to get the path.

How to get in-place archive custom folder name on office 365?

GET mailFolders/archivemsgfolderroot
I use distinguish name to get this in-place mailbox folder
and the response is:
...
"displayName": "Top of Information Store",
...
However, this is not the custom name I modified on office365.
Is it possible to get that custom name?
I also try to get distinguish folder in EWS managed API
<t:DistinguishedFolderId Id="archivemsgfolderroot" />
It returns the same name
...
<t:DisplayName>Top of Information Store</t:DisplayName>
...
--
Add two image ref.
how I add it
how it looks like at outlook
thanks for help
I see that a user can set a property, "ArchiveName", to give their archive mailbox a custom name. In powershell, this would be using a Set-Mailbox cmdlet.
https://learn.microsoft.com/en-us/powershell/module/exchange/mailboxes/set-mailbox?view=exchange-ps
That doc states that it applies to Outlook and OWA and, after a quick look, I can't see a way to get that property other than using Get-Mailbox which is not ideal. So as best I can tell it's not exposed through EWS or REST and thus probably isn't available through Microsoft Graph.
I would encourage you to file a suggestion: https://officespdev.uservoice.com/forums/224641-feature-requests-and-feedback/category/101632-microsoft-graph-o365-rest-apis
You can try the following endpoint
https://graph.microsoft.com/v1.0/me/mailFolders/archivemsgfolderroot/childFolders/AAMkADQ5OWMzMGEwLTg4ZjktNDk1Ny05NzFmLWRhZjg4ODU0YzUwYwAuAAAAAACtqDzk9UzLSpZsdesjndr1AQBNzq1HG8BvRYqBQbPeZSPaAAGdwZCCAAA=
(Replace the id to yours):https://graph.microsoft.com/v1.0/me/mailFolders/archivemsgfolderroot/childFolders/id

Graph request to list root children returns empty

I'm using the graph explorer to try list the root's children via call to GET /drive/root/children but getting empty response (while I have many files & folders in my directory):
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#drive/root/children",
"value": []
}
Any idea why and how to fix this?
Please use GET /me/drive/root/children to list your personal drive. GET /drive/root/children lists the content of your organization's drive/SharePoint site.

Google Drive queryForFilesList not returning any results

I'm currently having issues with the iOS Google Drive SDK. I'm using GTLQueryDrive queryForFilesList to search for a file in my Google Drive. All the files I want have a path in the format directory-name/file-name. Since the SDK/API doesn't allow searching for files using a full path, I'm using the following query to ultimately get it's downloadUrl. I'm using a query in the following format:
((title = 'directory-name') AND ('root' in parents) AND (mimeType = 'application/vnd.google-apps.folder')) OR
((title = 'file-name') AND (not 'root' in parents) AND (mimeType != 'application/vnd.google-apps.folder'))
The first line is meant to find all directories in the root directory whose name matches mine, and the second line should match all files with the same name. This should return the directory i'm looking for, the file i'm looking for, and maybe some other stuff (e.g. files with the same name in other directories). I have some code to figure out which file is the correct one.
The problem I'm having is that sometimes I get no results from the query. This generally happens after I rename the file, and rename it back, or other things like that. The weird part is that if I run either of the two lines of the query independently, it returns correctly, but together they don't.
Any help would be greatly appreciated, and I would gladly provide more information if required.
And yes, I'm using the kGTLAuthScopeDrive scope.
The ideal solution would be if I could just search using a full path, so if there's a way to do this, then I'm not aware.
Unfortunately, I was unable to get this to work. And also unfortunately, Google does not provide an API to query for a full path. So I resorted to iterating over the path to get the directory IDs, and then when I get to the file, get its ID and download it. Although slightly more complex, my solution was based on this question and chosen answer: What's the right way to find files by "full path" in Google Drive API v2

Resources