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

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;

Related

MS Teams Outgoing Webhook Without Mention Possible?

I'm trying to create a subscription to receive the contents of all new messages sent within a private Team, and so far it appears I have to configure a bot / webhook within Teams (and only messages #mentioned to that bot / webhook will be sent to me), or otherwise use the Graphs API (I can't determine whether the same caveat exists with #mentions).
The use case is to allow members of the Team to post messages, and for my listening application to consume the message contents and take an action (turn on a light, etc.. but external to Teams). I don't anticipate needing to write anything back into the Team.
I found this link in another post: https://blog.thoughtstuff.co.uk/2020/01/how-to-use-the-new-webhooks-for-microsoft-teams-channel-chat-messages/
Has anyone successfully been able to subscribe to all messages within a private team for a similar use case?
Thank you!
Posting the Answer for better knowledge
Copying from #Sridevi comments
To track messages and replies in a channel, you can create a change notification subscription at a channel level. Please follow this documentation.

Sending/Receiving multi-recipient SMS - Twilio API

I am writing an app that will facilitate the sending and receiving of SMS messages via a web application. I would like to allow for multiple recipients (not bulk, just a few recipients at most).
I understand that in order to send to multiple recipients, I have to make multiple API calls, and that is fine. The problem I am having is receiving text messages via the Webhook callback. If the SMS was sent to multiple recipients, I cannot see the other recipients in the callback, just myself as the recipient.
Because of this, I have no idea whether this message was intended for just me, or for other recipients as well. This is a problem, because I would like to show threaded conversations similar to Google hangouts, or the SMS applications on all Andorid and iPhones.
I cannot figure out a way to track conversations, if I can't tell if a received message was sent to just me, or a group of recipients. Any suggestions? I do not yes use Twilio on a production server, so if this is not possible to do using Twilio, but is possible using another service, that would be an option for me as well.
Twilio developer evangelist here.
Twilio doesn't fully support group messaging the way that you are used to it when using a phone. That actually relies on MMS under the hood to keep the members of the group chat synced up.
Where you make multiple API calls to send messages to each user, that is manifested as just a single message with no group attached. Thus, any reply to that message comes solely from that person you sent the message to. There is no group at all at this point.
The link that Alex shared in the comments is the closest way you can get group messaging to work. It relies on everyone messaging one Twilio number and the application behind it fanning the messages out to all the recipients. The blog post also comes with some handy subscribe/unsubscribe administration for the group.

How can I get notifications from Mailchimp's webhook API when I import contacts?

I wanted to synchronize my contacts from mailchimp to my app.
I did this by periodically asking Mailchimp if any contacts were updated or created .
Now, I want to do it using the Mailchimp's webhooks.
I have created a webhook in mailchimp and tested it and it works well when I do some changes as Admin using the Mailchimp UI, but when I add or update any contacts using import contacts functionality, I don't receive any notifications.
Mailchimp's webhook API says that they send notifications only when a change is made
by a subscriber
by an account admin
via the API
so, since I'm not getting the notifications I used to get using the previous method, is changing to webhooks a bad option?
Is there any way that I could get the notifications I used to get from my old method, using Mailchimp's webhooks?
Webhooks may have been omitted from imports to try and protect users from inadvertently DDoSiNg the hook destinations on large imports.
In regards to keeping these two data sets in parity, because webhooks don't have a trigger for import events, I might first suggest exploring another update method for adding subscriber data to the list in MailChimp.
Perhaps looking to the Batch operation options in MailChimp's API:
http://developer.mailchimp.com/documentation/mailchimp/reference/batches/
http://developer.mailchimp.com/documentation/mailchimp/guides/how-to-use-batch-operations/?utm_source=mc-api&utm_medium=docs&utm_campaign=apidocs&_ga=1.112643975.2008383502.1487629834
As this should allow large updates while keeping the external app abreast of any updates via the triggered webhooks.

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!!

Looking for clarifications on how to build a group chat app using Sinch platform

I am trying to figure out how to use sinch to build a basic group messaging app. It looks pretty simple but I have a few questions to help me understand the platform:
1) It seems like the platform doesn't support multiple conversations for one user. For example facebook messenger allows you to have many conversations with different people (different chats). But sinch only lets you send a message to a user with no conversation meta data. Or is it possible to send your message with meta data?
2)Do you manage users on the sinch platform? This means creating user objects and giving them id's etc or must this be done on another platform like parse?
3)How do you handle messaging logs? Like if I send a message to someone that's not logged in- how do I save it and also send them a push notification that a message was sent?
Thanks for the help everyone- the documentation is a bit dilute so I haven't been able to find answers to these questions yet :/.
You can send meta data with headers, to create your own meta data thing. But to be fair Sinch is more like multi recipient message than groups with channels.
No, we use delegated security
We will automatically deliver the message when the user logs on, we keep messages for 30 days for delivery.

Resources