/// <remarks/> public void ABFindContactsPagedAsync(ABFindContactsPagedRequestType ABFindContactsPaged1, object userState) { if ((this.ABFindContactsPagedOperationCompleted == null)) { this.ABFindContactsPagedOperationCompleted = new System.Threading.SendOrPostCallback(this.OnABFindContactsPagedOperationCompleted); } this.InvokeAsync("ABFindContactsPaged", new object[] { ABFindContactsPaged1}, this.ABFindContactsPagedOperationCompleted, userState); }
private void ABFindContactsPagedAsync(string partnerScenario, abHandleType abHandle, ABFindContactsPagedCompletedEventHandler abFindContactsPagedCallback) { if (NSMessageHandler.MSNTicket == MSNTicket.Empty || AddressBook == null) { OnServiceOperationFailed(this, new ServiceOperationFailedEventArgs("ABFindContactsPaged", new MSNPSharpException("You don't have access right on this action anymore."))); return; } bool deltasOnly = false; ABFindContactsPagedRequestType request = new ABFindContactsPagedRequestType(); request.abView = "MessengerClient8"; //NO default! if (abHandle == null || abHandle.ABId == WebServiceConstants.MessengerIndividualAddressBookId) { request.extendedContent = "AB AllGroups CircleResult"; request.filterOptions = new filterOptionsType(); request.filterOptions.ContactFilter = new ContactFilterType(); if (DateTime.MinValue != WebServiceDateTimeConverter.ConvertToDateTime(AddressBook.GetAddressBookLastChange(WebServiceConstants.MessengerIndividualAddressBookId))) { deltasOnly = true; request.filterOptions.LastChanged = AddressBook.GetAddressBookLastChange(WebServiceConstants.MessengerIndividualAddressBookId); } request.filterOptions.DeltasOnly = deltasOnly; request.filterOptions.ContactFilter.IncludeHiddenContacts = true; // Without these two lines we cannot get the Connect contacts correctly. request.filterOptions.ContactFilter.IncludeShellContactsSpecified = true; request.filterOptions.ContactFilter.IncludeShellContacts = true; } else { request.extendedContent = "AB"; request.abHandle = abHandle; } MsnServiceState ABFindContactsPagedObject = new MsnServiceState(partnerScenario, "ABFindContactsPaged", true); ABServiceBinding abService = (ABServiceBinding)CreateService(MsnServiceType.AB, ABFindContactsPagedObject); abService.ABFindContactsPagedCompleted += delegate(object sender, ABFindContactsPagedCompletedEventArgs e) { OnAfterCompleted(new ServiceOperationEventArgs(abService, MsnServiceType.AB, e)); // Cancelled or signed off if (e.Cancelled || NSMessageHandler.MSNTicket == MSNTicket.Empty) return; if (e.Error != null) { // Handle errors and recall this method if necesarry. if ((e.Error.Message.ToLowerInvariant().Contains("need to do full sync") || e.Error.Message.ToLowerInvariant().Contains("full sync required"))) { if (abHandle == null || abHandle.ABId == WebServiceConstants.MessengerIndividualAddressBookId) { // Default addressbook DeleteRecordFile(true); } else { // Circle addressbook AddressBook.RemoveCircle(new Guid(abHandle.ABId).ToString("D").ToLowerInvariant(), false); } // recursive Call ----------------------------- ABFindContactsPagedAsync(partnerScenario, abHandle, abFindContactsPagedCallback); } else { Trace.WriteLineIf(Settings.TraceSwitch.TraceVerbose, "UNHANDLED ERROR: " + e.Error.Message.ToString(), GetType().Name); // Pass to the callback if (abFindContactsPagedCallback != null) { abFindContactsPagedCallback(sender, e); } } } else { // No error, fire event handler. if (abFindContactsPagedCallback != null) { abFindContactsPagedCallback(sender, e); } } }; RunAsyncMethod(new BeforeRunAsyncMethodEventArgs(abService, MsnServiceType.AB, ABFindContactsPagedObject, request)); }
/// <remarks/> public void ABFindContactsPagedAsync(ABFindContactsPagedRequestType ABFindContactsPaged1) { this.ABFindContactsPagedAsync(ABFindContactsPaged1, null); }