Using MS Graph SDK or MS graph explorer, we are trying to replace an attachment within a message. Updating a message attachment is not supported yet by ms graph API (or at least that's what we know). that's why we do the operation in the following steps:
get the original attachment content.
modify that content.
delete the original attachment.
then add the modified content as a new attachment with the same name.
This works. However, randomly fails, resulting in two attachments, the original and the new instead of the message having one updated attachment. the API returns success results in both cases with no indication of what might be the problem.
Here are the calls:
First Request to delete the attachment (step 3):
DELETE https://graph.microsoft.com/v1.0/me/messages/{messageId}/attachments/{attachmentId}
Second Request to add the modified attachment (step 4):
POST https://graph.microsoft.com/v1.0/me/messages/{messageId}/attachments
body:
{
"#odata.type": "#microsoft.graph.fileAttachment",
"name": "smime.p7m",
"contentType": "application/x-pkcs7-mime",
"contentBytes": "{contentBytes}"
}
Any feedback on what might be causing the issue would be appreciated.
After some research on this, it looks like this is not an issue with ms graph. The thing is that we are using outlook for mobile on IOS to check the message after being manipulated and the outlook app does not update the attachment correctly which results in two attachments being displayed. If we query the message using ms graph explorer we can see that the attachment was replaced correctly. We concluded that this is a bug in Outlook app o IOS.
To confirm, we reinstalled the outlook app on IOS and the message with its attachments was displayed correctly.
Related
Every day, we download a youtube content owner video report for two different content owners. We connect to the API and pull data from the following endpoint: content_owner_video_metadata_a2. Since November 17th, 2022, we have NOT been able to pull any new data for this report. In fact, the API returns no data at all. My business users are able to see this data in the front-end GUI for content owners and on their end, it also shows that the data has not been updated since the 17th. Is there an issue that we should know about? How can we get this data to be updated?? Please let me know if you need any other details to help you understand my issue. Thanks!
I was expecting the API to return data, which I then download into a CSV file. No data is being returned and so no file is being created.
I'm using consumer OneNote in this scenario.
I have been querying my OneNote pages across a number of Notebooks using Graph with some success, but I've run into a strange issue. I'm note sure if it's a quirk in Graph or my Notebooks. I've reproduced the problem using Graph Explorer.
For example, If I issue the following request using Graph Explorer:
https://graph.microsoft.com/v1.0/me/onenote/pages?$top=100&$filter=id+eq+'0-fe674713edf84357871dbc179dfd924c!1-816F7725BEF00A5F!731388'
then I get a JSON response with the 'value' full of useful data.
If I issue the following request using Graph explorer:
https://graph.microsoft.com/v1.0/me/onenote/pages?$top=100&$filter=id+eq+'0-1f9aa8a73e9a4f14b4daa7762b5aa530!42-816F7725BEF00A5F!665027'
then I get a JSON response with an empty 'value'. All I've done is changed one known good ID for another known good ID.
I can:
Access both pages from Graph Explorer using a direct URL with the IDs used above
Access both pages using OneNote web app and Windows 10 version
Search for the 'lost' pages by title in the OneNote user interface successfully
It doesn't seem to matter what attribute of the pages I search for, the result is the same. Interestingly this only appears to affect pages from a certain point in one Notebook onward. The affected pages look OK in OneNote and load in both Web and Windows 10 version without problems.
I can create new pages in the Notebook containing the problem pages, but the new pages don't show up when I try to search for them using Graph.
Has anyone got a suggestion as to what I should try next?
EDIT:
New pages created in the problem Notebook do appear when searched for, it appears I was too impatient. The existing pages still cannot be found.
If the filtered page is not in the top 100 results, the response will be empty
I'm trying to retrieve emails using Microsoft Graph(and the Microsoft Graph SDK) and i'm running into the following problem : when the email has another Outlook message attached to it and that message also has attachments, i'm unable to get them.
I'm able to retrieve the attached message with the following query, but I can't do a second expand on attachments as I'm already doing one to get the OutllokItem(message)
/v1.0/users/<UserName>/messages/<MessageId>/attachments/<AttachmentID>?$expand=microsoft.graph.itemattachment/item
Is this possible at all ? Thanks in advance.
For anyone looking for a solution, there's a feature currently available on beta only that allows you to get the whole message in Mime text format.
To get an attachment
/beta/users/<UserName>/messages/<MessageId>/attachments/<AttachmentID>/$value
To get the full initial message :
/beta/users/<UserName>/messages/<MessageId>/$value
See https://learn.microsoft.com/en-us/graph/api/attachment-get?view=graph-rest-beta&tabs=cs for details
I'm having some issues using a custom connector to get what I want out of the Microsoft Graph. Essentially, what I am looking to do is take the Email Activity User Detail report and turn it into a Power BI report.
The URL for that report is as follows:
/v1.0/reports/getEmailActivityUserDetail(period='D7')
In order to create this custom connector, I have been using the MyGraph Connector Sample as I'm not very familiar with the use of Power Query, nor the Graph API.
I have created the connector and can connect to the API and everything, but rather than return me the data, all the query does it return me a byte array I can't seem to do anything with.
From looking at Fiddler traces, the actual data I want is being picked up along the way, but it looks like the Graph API uses a redirect URL to the download, which I'm not sure my Power Query code is handling. I think it may just be returning the redirect URL as a string rather than the actual data.
Further to this, my query has no code to handle the NextLink if it goes over the number of returned rows (I think 200?), so I imagine it will not return the full dataset once I do get it working. How is this best handled?
Unfortunately, I am very new to Power Query (this is my first encounter with it, in fact), so I'm not sure where to begin to make the necessary changes to get what I need.
Any assistance would be greatly appreciated.
The Microsoft Graph API - GET Reports in Graph Explorer and Power BI question touches on a similar issue, though that is through the Application interface itself, which seems to be unable to get the necessary authorization tokens by itself.
EDIT: I have managed to fix the issue thanks to the advice from Marc LaFleur.
The problem was indeed that I was trying to use the Odata.Feed as the source. Changing the line:
source = OData.Feed("https://graph.microsoft.com/v1.0/me/", null, [ ODataVersion = 4, MoreColumns = true ])
To:
source = Csv.Document(Web.Contents("https://graph.microsoft.com/v1.0/reports/getEmailActivityUserDetail(period='D7')"))
Fixed the issue and returned the correct values with no other changes.
Microsoft Graph's Reports are not traditional REST endpoints. Rather than returning OData/JSON, they return a temporary URL to a physical file in CSV format.
From the documentation:
If successful, this method returns a 302 Found response that redirects to a preauthenticated download URL for the report. That URL can be found in the Location header in the response.
From the example you linked too, it looks like it is expecting an OData.Feed source (source = OData.Feed). In this case, you're not getting an OData result but rather a URL to a CSV file. I believe you're looking for Csv.Document instead.
I have created an email template using Outlook 2013. In this template I have some images hosted on the web.
When i send the mail everything is seen Ok on the various Outlook version. But when the mail is seen on the Blackberry My mail seems ok but at the end of the mail, the images are also listed as attachments. So I see the correct template and the list of images. How can i prevent this behaviour? I need to keep the same behaviour as in the Outlook version (not display the listing of the images as attachments at the end of the mail)
Could you point me in the right direction?
Thank you so much.
As far as I know, there is no way to prevent Outlook from sending images as MIME attachments. Other Outlooks will interpret them correctly, whereas most email clients will see them at attachments.