can we get deltaLink for messages api irrespective of message folders - outlook

synchronization works for messages in folder with this api
GET https://graph.microsoft.com/v1.0/me/mailFolders/{id}/messages/delta
we can get all messages in mailbox with this api
GET https://graph.microsoft.com/v1.0/me/messages/
Is there any way to synchronize messages in mailbox (as deltaLink in first api) irrespective of folders...

Not today. Delta queries are only specific to a folder, there's no Delta query that allows you to get all changes in all folders.
You could request the feature on uservoice

Related

internetMessageHeaders now available using graph api endpoint for messages in the sent items folder

Originally posted by #jasonjoh in https://github.com/microsoftgraph/microsoft-graph-docs/issues/2716
Regarding answer given by https://github.com/microsoftgraph/microsoft-graph-docs/issues/2716#issuecomment-580751583
No, internet headers just do not exist on the copy in Sent Items.
For shared mailbox messages in the sent items folder, we recently noticed using the graph api endpoint "https://graph.microsoft.com/v1.0/me/mailFolders/sentitems/messages?$select=internetMessageHeaders" we can access the headers. This was not the case earlier, so can we get a confirmation that this new feature can be relied upon.

Polling Outlook mail folder (inbox) occasionally returns ErrorInvalidMailboxItemId

Something strange occurs that I cannot find the cause or reason for.
I have a loop which polls Inbox for an authorized user every minute. This goes fine for some time, but then I get 404 and error code is ErrorInvalidMailboxItemId (Item Id doesn't belong to the current mailbox.). I for example get this two times and then the polls starts working again.
GET /v1.0/me/mailFolders/xxx/messages?$filter=isRead%20ne%20true&$count=true&$top=10
Nothing that I can see is different between the polls, so I'm baffled why server suddenly returns 404.
Searching for this error mentions shared mailbox, archive and delegated, however this inbox is neither of these, and besides the error should then be consistent which it is not.
Same bearer token used for all the polls, both when it works, then does not and then when it starts working again.
Any ideas why this goes wrong? Or do I have to look for this error and then just retry or ignore the error for some time?
Thanks
I would try the following:
Do a re-try and see if it works
Implement the detailed response logging at the custom application end, isolate the item, make the same API call in MS Graph Explorer and see if it exists, gets the data or not.
Make sure you have necessary permissions to access the shared mailbox, archive mailboxes or the targeted mailboxes etc

Folder.Bind() Stuck when using Subscriptions for multiple accounts through EWS Managed API

I am using a streaming subscription (EWS Managed API) to subscribe to events on one mailbox. Now, instead of doing this directly, I want to subscribe and take action on incoming mails on these mailboxes through impersonation.
How to achieve it?
What I have Tried:
I did setup multiple streaming subscriptions using service.ImpersonatedUserId() but when i get a event(i get events successfully for the 2 mailboxes i have subscribed to) and try to take some action for e.g EmailMessage.Bind(Item Id) or Folder.Bind(), the code stucks! I dont get any error message. I even tried TraceEnabled= true, I found nothing!
I did see this MSFT link but didn't find an answer.
I need help with for e.g moving the mail to another folder for multiple mailboxes through EWS subscriptions.
The default concurrent connection limit in .net is 2 by default https://learn.microsoft.com/en-us/dotnet/api/system.net.servicepointmanager.defaultconnectionlimit?view=netframework-4.7.2 because Streaming notifications require a concurrent connection to work this is a common issue.So all you should need to do is set the connection limit higher eg
System.Net.ServicePointManager.DefaultConnectionLimit = 100;

gmail API Users.messages: list is not getting replies

If I make a request to the gmail API for Users.messages.list it will return 100 of the newest messages.
If I make another request, 1 minute later and there are no new emails it will return the same 100 most recent messages.
If I make a third request, 2 minutes after the original and there is a reply to one of the 100 most recent messages it will still return the 100 most recent messages.
The problem with this is the it only returns the message id and thread id, not if there is a new reply or not. That would mean that I would have to check every message that I have locally stored, or every one of the 100 returned messages just to know if there was a reply to it or not.
The way that works, you couldn't "check" your email via the api because if you had stored 10000 messages and you were checking replies on all of them you would use up your entire API "number of requests" allocation in a single day!
What's wrong with you Google?
Sure I could use pop3 or imap but why when I could just use something like /list_recent?
You should definitely take a look at this part of the Gmail API documentation: https://developers.google.com/gmail/api/guides/push
Basically, it explains you how you can setup a "watch" over a Gmail account and receive notifications (new e-mail, deleted e-mail, labels added...) through Pub/Sub, the messaging queue protocol from Google.
The notifications will contain an historyId, which is a kind of milestone in the Gmail account. Using the /history endpoint, you'll then get the e-mails that were added and/or deleted since this history point. You have to store the latest historyId you handled somewhere in your app, so that you can query the right changes (and not miss anything) on the next notification.
If you don't need to react to changes in real-time, maybe you can call the /history endpoint periodically, but it will definitely be less efficient at scale.
It takes a bit of work to get this working but at the end of the day you get a very efficient system able to react about changes in real-time.

EWS API - Error when recreating notification subscriptions

When working with pull subscriptions to Office365 calendar folders, I've been getting a lot of ErrorReadEventsFailed messages in the SendNotification request. This error essentially means that the subscription can no longer be found, and the server should no longer expect new notifications.
Checking Microsoft's recommended error handling, the solution is to use Autodiscover to rediscover the ExternalEwsUrl or EwsPartnerUrl, and create a new subscription.
With Office365, the AutoDiscovery service seems near impossible with a combination of OAuth2 service accounts so I've been using https://outlook.office365.com/EWS/Exchange.asmx as the main EWS endpoint.
However, when I try to create a new subscription for the specific calendar folder, I keep getting a generic 500 ErrorNoRespondingCASInDestinationSite error:
Exchange Web Services are not currently available for this request because none of the Client Access Servers in the destination site could process the request.
The strange part is this only happens directly after receiving the initial ErrorReadEventsFailed error. If I try again in, say, 30 seconds, the request goes through without a problem.
After doing some research, it seemed that most users found it helpful to ensure that the X-AnchorMailbox header was set properly for the user that the service account wishes to impersonate. I double-checked this header, and it is indeed being sent along the request to resubscribe.
This problem may be solvable by an exponential back-off solution, or by just retrying X amount of times until the request goes through. It seems to me that when the subscription gets "lost", the O365 service needs time to change the DNS of the Exchange server (it's the only thing I can think of).
Any help would be greatly appreciated!
Given the documentation at: https://msdn.microsoft.com/en-us/library/office/dn458788(v=exchg.150).aspx
When a subscription is lost, or is no longer accessible, it is best to create a new subscription and not include the old watermark in the new subscription. Resubscribing with the old watermark causes a linear scan for events, which is costly.
Instead, create a new subscription and compare folder properties to look for content changes that occurred between the lost subscription and the new subscription. The extended folder properties that we recommend that you check are PR_LOCAL_COMMIT_TIME_MAX (0x670a0040) and PR_DELETED_COUNT_TOTAL (0x670b0003).
You can do this by creating an extended property definition.
I think this may help you!!

Resources