Download attachment in private Microsoft Team chat via Graph API - microsoft-graph-api

I am trying to download attachments in private chat via graph API. When I execute the below query in Microsoft Graph Explorer. I am able to get the attachment id and path.
https://graph.microsoft.com/v1.0/me/chats/{chat-id}/messages/{message-id}/
But how can I download this file?
Files are not available when requested for hostedContents. So, I believe hostedContents is not an option.

Firstly the files are hosted in chat so it will not give 404 before but after exporting to onedrive then it will delete from there thats why its returning 404.
You have to use below API's to download file from onedrive because its exported to onedrive.
GET /drives/{drive-id}/items/{item-id}/content
GET /groups/{group-id}/drive/items/{item-id}/content
GET /me/drive/root:/{item-path}:/content
GET /me/drive/items/{item-id}/content
GET /shares/{shareIdOrEncodedSharingUrl}/driveItem/content
GET /sites/{siteId}/drive/items/{item-id}/content
GET /users/{userId}/drive/items/{item-id}/content
Reference Doc: https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http

Related

Get the media file from SharePoint after getting a callRecord notification

I have subscribed to /communications/callRecords to get notifications whenever a call is available in Teams. At the moment the call is saved in SharePoint under the Recordings folder.
Is there a way in the Microsoft Graph API to link the callRecord to a file in SharePoint Drive to download it?
Thanks.
AFAIK the above feature is not available. Rather you may want to subscribe to callrecords and see if it provides the location or not.

Can I send a OneDrive File Request using Microsoft's Graph API?

Microsoft OneDrive allows you to send a "file request" so others can send you very large files without needing a OneDrive account themselves.
I'm wanting to use an API (probably Microsoft Graph API)) to automatically create file requests on a user's behalf, and delete them later too.
Is it possible to create a OneDrive file request via an API? If so, where is that documented?
Thanks for your time!
Looks like that feature is not available yet. I see a feature request for the same in MS Graph user voice page. Please upvote/comment on the same so that the feature team will get better visibility.

Is there a way to create a static public URL for an image in my personal OneDrive using Microsoft Graph API?

What I'm trying to achieve via Microsoft Graph API is to upload an image to my personal OneDrive and get a URL which my code will then send to someone else to view at a later date. This URL must require no authentication and must able to be used in an img tag for a website.
I've managed to upload the image and use the /thumbnails endpoint to get the URL but it seems like the URL expires after some time (I think around 24 hrs). I have also tried:
using the /content endpoint - that also created a short-lived URL.
using the /createLink endpoint then encoding the URL and using the /shares endpoint - that also created a short-lived URL.
So...anybody know of any alternatives to create a non-expiring public URL for images on personal OneDrive accounts using Microsoft Graph API?
Many thanks in advance!

Can we access archive mailbox (In Place archived) using Graph API

I am trying to access Archive Mailbox (In Place archived) , using MS Graph API , but found that its not working.
Does MsGraph support it ? If not then whats the other programatic way to get this content? Any other API?
No InPlace Archives aren't currently accessible using the Graph API, you can access them using EWS https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth then something like this would list the folder in the Archive
FolderView fv = new FolderView(1000);
FindFoldersResults ffResults = service.FindFolders(WellKnownFolderName.ArchiveMsgFolderRoot, fv);

How to get the externally shared user's profile information for one drive using Microsoft Graph api

To get External user information if we share the file with specific people through link.
You can use following end point for fetching external users in your AD:
https://graph.microsoft.com/beta/users?$filter=userType eq 'Guest'
make sure that you have to select beta version of microsoft graph for additional user properties.
If you just want to get the external user list, you can use "/users?$filter=userType eq 'Guest'" resolve your issue.
If you want to get the access log of share file through link:
No matter you use OneDrive or OneDrive for business, we cannot use Graph API to get the user who have access the share file through link.
If you share the Team site's document, we can use JSOM to get the user profile first and store it to the access log. Then use the get user api to get the external user info.
If you share the document from OneDrive/OneDrive for business, we cannot assign our custom access log and no known Graph API for this too. You can submit an feature request in the UserVoice, meanwhile, you can try to see the audit logging first.

Resources