protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state) { var pushNotification = PushNotification.Get(context); var contentListPath = ContentListPath.Get(context); if (string.IsNullOrEmpty(contentListPath)) { Logger.WriteError(Logger.EventId.NotDefined, "ExchangePoller activity: ContentList path is empty.", ExchangeHelper.ExchangeLogCategory); return(null); } var GetMessageInfosDelegate = new Func <bool, string, EmailMessage[]>(GetMessageInfos); context.UserState = GetMessageInfosDelegate; return(GetMessageInfosDelegate.BeginInvoke(pushNotification, contentListPath, callback, state)); }