Push Notifications with specified credentials / as another account

Not open for further replies.

Massimo Russo


I'm using the Exchange push notifications the first time. I'm trying to push a notification every time a new appointment has created, modified, deleted and so on.

Actually the push works pretty fine, the asmx receives all the calls. For this, I'm using the sample code provided in the Exchange Server 2010 Web Services SDK, I think it's called " PushNotificationSubscriber" :

public static void SubscribeForPushNotifications() { System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate (Object obj, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { // Replace this line with code to validate server certificate. return true ; }; // Create the bindings and set the credentials. ExchangeServiceBinding esb = new ExchangeServiceBinding(); esb.Url = " https://myexchange2010/EWS/Exchange.asmx" ; esb.Credentials = new NetworkCredential(" user" , " password" , " domain" ); // Create a new subscription. SubscribeType subscribeRequest = new SubscribeType(); PushSubscriptionRequestType pushSubscription = new PushSubscriptionRequestType(); // Subscribe to events in the inbox folder. BaseFolderIdType[] folders = new BaseFolderIdType[1]; DistinguishedFolderIdType folderId = new DistinguishedFolderIdType(); folderId.Id = DistinguishedFolderIdNameType.calendar; folders[0] = folderId; pushSubscription.FolderIds = folders; // Subscribe to all events. NotificationEventTypeType[] eventTypes = new NotificationEventTypeType[6]; eventTypes[0] = NotificationEventTypeType.NewMailEvent; eventTypes[1] = NotificationEventTypeType.CopiedEvent; eventTypes[2] = NotificationEventTypeType.CreatedEvent; eventTypes[3] = NotificationEventTypeType.DeletedEvent; eventTypes[4] = NotificationEventTypeType.ModifiedEvent; eventTypes[5] = NotificationEventTypeType.MovedEvent; pushSubscription.EventTypes = eventTypes; // Receive push notifications every 1 minutes. pushSubscription.StatusFrequency = 1; // Identify the location of the client Web service. pushSubscription.URL = " http://MySharePoint/_vti_bin/PushReceiver.asmx" ; // Form the subscribe request. subscribeRequest.Item = pushSubscription; // Send the subscribe request and get the response. SubscribeResponseType subscribeResponse = esb.Subscribe(subscribeRequest); // Check the result. if (subscribeResponse.ResponseMessages.Items.Length > 0 && subscribeResponse.ResponseMessages.Items[0].ResponseClass == ResponseClassType.Success) { SubscribeResponseMessageType subscribeResponseMessage = subscribeResponse.ResponseMessages.Items[0] as SubscribeResponseMessageType; using (StreamWriter sw = new StreamWriter(" MailboxEventLog.txt" )) { sw.WriteLine(" Subscribed for Push notifications: {0}" , subscribeResponseMessage.SubscriptionId); } } CreateXmlMessageTextFile(subscribeRequest, subscribeResponse); }

My problem now is that the web service, to which the notifications will be pushed, needs credentials to logon to. This web service is a custom SharePoint web service: The idea is to do something in SharePoint with the SP object model, as soon as something happens on the exchange server. Anonymous access is, sadly, not an option.

Is there a way to tell exchange that it has to call the web service (.asmx by the way), where the notification is going to be sent to, with specific credentials (like username, password, domain)?
Next thing is that the exchange is running under another domain, than SharePoint is.
I've got SharePoint 2010 running locally on my notebook with Windows 7 (attached to our company domain) and Exchange 2010 is running inside a VM on the same notebook (hosting it's own active directory, not attached to company domain).

At the moment I'll always get the following error, 'cause Exchange tries to call the receiver web service without any credentials or logon information:

A notification for subscription [GQBtcnVleGNoYW5nZTIwMTAuZGV2LmxvY2FsEAAAANWqQz1YnDJBuYzqw/JGEpUcnOHPFD3NCA==] against endpoint [http://iclocal.upgnb055.local/_vti_bin/PushReceiver.asmx] couldn't be sent. (Send attempts: 2) Details: WebException: The remote server returned an error: (401) Unauthorized. StatusCode: Unauthorized Unauthorized at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at Microsoft.Exchange.Services.Core.NotificationServiceClient.HandleResponse(IAsyncResult responseAsyncResult)

Thanks in advance for your help!


Allen Song


For this issue, please post it into the Development forum of the Exchange.



Allen Song
Not open for further replies.
Thread starter Similar threads Forum Replies Date
T How can Exchange be configured to sync/push one-way so that the server data can't be affected Exchange Server Administration 0
B Push Quick Parts to All Users Using Outlook 1
D How to push a second outlook 2007 'private' calendar on exchange 2007 to my mobile phone. Using Outlook 1
T push "send/receive all folders" and nothing happens, check "Show progress" and it's empty. Using Outlook 10
N Push a single contact through to excel Outlook VBA and Custom Forms 1
T Why does outlook 2010 convert only some forum notifications to plain text? Using Outlook 2
N Outlook 365 Email Notifications Using Outlook 0
O Delete duplicate emails - subscription notifications Using Outlook 5
Rupert Dragwater Facebook notifications marked as Norton Antispam Using Outlook 6
P Disable Spam Notifications & Sounds Using Outlook 3
Rick Rickert Would like bigger meeting notifications. Using Outlook 3
M Mobile notifications and sync in Outlook.com Using Outlook.com accounts in Outlook 2
M Can't Delete iCloud Calendar Notifications From Outlook 2016 Using Outlook 0
M Reminders or Notifications for Internet Calendars Using Outlook 1
D Limiting email notifications message Using Outlook 1
V Disabling all delete notifications Using Outlook 0
J Auto Accept Notifications from a shared icloud calendar? Using Outlook 4
D Stop meeting acceptance notifications Using Outlook 1
D Cancelled Meeting Notifications to another mail address Outlook VBA and Custom Forms 1
P Outlook 2013 email notifications Using Outlook 1
J Calender notifications from a shared generic mailbox. Using Outlook 1
J Up date notifications? BCM (Business Contact Manager) 1
M My Outlook notifications are off by 25 minutes Using Outlook 0
P Outlook 2013 Mail Notifications appear for ALL emails--no good Using Outlook 1
S Questions about Calendar Notifications Using Outlook 1
S Notifications in Outlook Using Outlook 1
F Stop message recall notifications in the middle of the recall process Using Outlook 3
G how to setup Exchange 2010 Anti-Spam notifications? Exchange Server Administration 1
M outlook 2010 meeting forward notifications Using Outlook 1
M outlook 2010 meeting forward notifications Using Outlook 2
K How do I get email notifications when receiving IMAP email? Using Outlook 6
R Client Holiday Notifications Using Outlook 2
C Meeting forward notifications in Outlook 2010 or 2007 go to junk mail Using Outlook 4
C Meeting forward notifications in Outlook 2010 or 2007 automatically going to junk e-mail folder Using Outlook 1
O FaceBook Notifications Using Outlook 2
M All new email notifications suddenly no longer working using Outlook 2010 64 bit and Hotmail Connect Using Outlook 1
S Rogue calendar notifications Using Outlook 1
K Outlook 2007 Shared Calendar Notifications Using Outlook 3
R e mail notifications Using Outlook 1
A notifications couldn't be retrieved Exchange Server Administration 21
J Delete Appointments with Notifications Outlook VBA and Custom Forms 1
T Search for incoming e-mails for a specified time range Using Outlook 1
M MsgBox when not sending from specified account Outlook VBA and Custom Forms 2
R When rules lose track of "specified folder" Using Outlook 6
stephen li VBA Outlook send mail automatically by specified outlook mail box Outlook VBA and Custom Forms 1
P move a specified email "From" tag items to a certain folder whenever there is "New Mail" in the inbo Outlook VBA and Custom Forms 5
G Rule - All email from a specified domain Using Outlook 2
mikolajek Digital signing message from a specified account Using Outlook 2
L Outgoing Email attachment error "the system cannot find the file specified" Using Outlook 3
I Re: Windows cannot access the specified device, path, or file. Using Outlook 0
Similar threads