/// <summary> /// /// Creates or updates a user in 360, identified by its login name. If /// the user does not exist, it is created. If it exists, it is updated to /// match the input. /// A user must be connected to an existing 360° contact person, so /// always call SynchronizeContactPerson in the contact service first. /// /// </summary> /// <returns>SynchronizeUserOKResponse</returns> public static SynchronizeContactPersonOKResponse SynchronizeContact(this ServiceHelper servicehelper, SynchronizeContactPersonArgsParameter synchronizeContactArgsParameter) { try { SynchronizeContactPersonArgs synchronizeContactArgs = new SynchronizeContactPersonArgs(synchronizeContactArgsParameter); SynchronizeContactPersonOKResponse synchronizeContactOKResponse = servicehelper.ContactService.SynchronizeContactPerson(synchronizeContactArgs); return(synchronizeContactOKResponse); } catch (Exception e) { //Adding explaination and throwing again, shoud be catched in application that is using the helper throw new Exception("Syncronizeing of Contact failed, se inner exception", e); } }
/// <summary> /// /// Creates or updates a contact person contact in 360° based on /// ExternalId. /// If the supplied ExternalId does not exists in 360° the contact is /// created. /// If the supplied ExternalId exists in 360° the contact is updated /// to mirror the supplied information. /// /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='synchronizeContactPersonArgs'> /// (See model for parameter info) /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <SynchronizeContactPersonOKResponse> SynchronizeContactPersonAsync(this IContactService operations, SynchronizeContactPersonArgs synchronizeContactPersonArgs = default(SynchronizeContactPersonArgs), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.SynchronizeContactPersonWithHttpMessagesAsync(synchronizeContactPersonArgs, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// /// Creates or updates a contact person contact in 360° based on /// ExternalId. /// If the supplied ExternalId does not exists in 360° the contact is /// created. /// If the supplied ExternalId exists in 360° the contact is updated /// to mirror the supplied information. /// /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='synchronizeContactPersonArgs'> /// (See model for parameter info) /// </param> public static SynchronizeContactPersonOKResponse SynchronizeContactPerson(this IContactService operations, SynchronizeContactPersonArgs synchronizeContactPersonArgs = default(SynchronizeContactPersonArgs)) { return(Task.Factory.StartNew(s => ((IContactService)s).SynchronizeContactPersonAsync(synchronizeContactPersonArgs), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }