/// <summary> /// Save my attachments to CRM, and relate them to this emailResult. /// </summary> /// <param name="emailResult">A result object obtained by archiving me to CRM.</param> private void SaveAttachments(RESTObjects.SetEntryResult emailResult) { foreach (ArchiveableAttachment attachment in Attachments) { try { BindAttachmentInCrm(emailResult.id, TransmitAttachmentPacket(ConstructAttachmentPacket(attachment)).id); } catch (Exception any) { log.Error($"Failed to bind attachment '{attachment.DisplayName}' to email '{emailResult.id}' in CRM", any); } } }
/// <summary> /// Relate this email result (presumed to represent me) in CRM to these contact ids. /// </summary> /// <param name="crmContactIds">The contact ids which should be related to my email result.</param> /// <param name="emailResult">An email result (presumed to represent me).</param> private void SaveContacts(List <string> crmContactIds, RESTObjects.SetEntryResult emailResult) { var restServer = SuiteCRMUserSession.RestServer; foreach (string contactId in crmContactIds) { try { restServer.GetCrmResponse <RESTObjects.eNewSetRelationshipListResult>("set_relationship", ConstructContactRelationshipPacket(emailResult.id, contactId)); } catch (Exception any) { log.Error($"Failed to bind contact '{contactId}' to email '{emailResult.id}' in CRM", any); } } }