Tuesday 15 April 2014

exchangewebservices - Powershell EWS SubscribetoPullNotifications for multiple mailboxes in a single session -


My goal for this PowerShell script is to monitor a particular folder for all mailboxes in Exchange Online (Office 365) and If the item is created, it will send that email to another SMTP address as an email. I can get it for just one mailbox without any errors using impersonation.

However, I am trying to create a list of Folderider array for each mailbox:

  {$ in foreach $ Usermailbox $ mboxlist) farray + = Get- TargetF ($ usermailbox)}   

this type $ farray the object:

  Microsoft Exchange.WebServices.Data.FolderId ($ tfTargetFolder.Id)   

I then seek Event:

  $ service.SubscribeToPullNotifications ($ farray, 60, $ Null, [Microsoft.Exchange.WebServices. Data.EventType] :: Created   

Note that the Get-TargetF function is autodisched for each mailbox To get the server name through. It also uses $ service.FindFolders to find the correct folder.

While displaying results in error for some mailboxes, I did run the script, but not all (I filtered 5 mailboxes for testing). New Object: Manufacturer was not found. Can not find suitable constructor for Microsoft type Exchange. Web services.data.folder id In C: \ document \ mysc.ps1: 63 char: 22 + $ inboxID = new object & lt; & Lt; & Lt; & Lt; Microsoft.Exchange.WebServices.Data.FolderId ($ tfTargetFolder.Id) + Series Info: Object Notfound: (:) [New-Object], Pisargment Akspshn + fully qualified Irraidi: Kantfind Apiproptiatt Kantor, Maikrosoftkpovrsel. Commands New object commend

And when I start listening to events, I get this error:

  "Subscriber notifications" and logic count: " 4 "can not get the overload. In C: \ Documents \ mysc.ps1: 79 char: 59 + $ Bridge subscription = $ service. SubscribeToPullNotifications & lt; & Lt; & Lt; & Lt; ($ Farera, 60, $ tap, [Microsoft Exchange. Vebsrvisejkdeta. Anttaip] :: Not) + Sreniinfo: Not specified Created: (:) [], qualified as legal exception + full Iroaraiaidi: Methdkountcol Notfindbast   

I have not even thought how to deal with issues related to throttling with EWS on Exchange Online has been mentioned. I suspect that the above subscription is by default for one hour Time will pass.

What is the correct way to get it into a single pssession?

I think that you have only one option to create separate subscriptions for each mailbox and then to see the loop one by one Call GetEvents whether to create a new event.

According to my understanding, specifying folder IDs from different mailboxes can not work because impersonation is about calling as a different user If there is more. NY does not delegate authority to the specified folder ID in the user's request, are rather Povrhel instead is bound to fail. You may console Aepliket, which actually works, check out immediately. It Any PS specific errors are to avoid hindering the real problem check.

With the Streaming Subscriber Approach, depending on your server relationship But as you can tell the mailbox as a group, MSDN should see the trade-off between moment vs. streaming before you make a decision.

No comments:

Post a Comment