public IHttpActionResult GetOrganizations([FromUri] DynamicsCredentials credentials) { if (!ModelState.IsValid) { return(Unauthorized()); } try { crmService = new DynamicsService(credentials); var organizations = crmService.GetOrganizations().Select(o => new { o.UniqueName, o.FriendlyName }); return(Ok(organizations)); } catch (MessageSecurityException) { return(Unauthorized()); } catch (SecurityAccessDeniedException) { return(Unauthorized()); } }
public IHttpActionResult GetMarketLists([FromUri] DynamicsCredentials credentials, [FromUri] bool translate = false) { if (!ModelState.IsValid) { return(Unauthorized()); } try { crmService = new DynamicsService(credentials); var lists = crmService.GetAllMarketLists(); var goodLookingLists = GetValuesFromLists(lists, translate); return(Ok(goodLookingLists)); } catch (MessageSecurityException) { return(Unauthorized()); } catch (SecurityAccessDeniedException) { return(Unauthorized()); } }
public IHttpActionResult ValidateCredentials([FromUri] DynamicsCredentials credentials) { if (!ModelState.IsValid) { return(Unauthorized()); } try { if (!string.IsNullOrEmpty(credentials.Domain)) { crmService = new DynamicsService(credentials); } else { //Will create service and try to fetch all lists to validate new DynamicsService(credentials).GetAllMarketLists(); } return(Ok()); } catch (MessageSecurityException) { return(Unauthorized()); } catch (SecurityAccessDeniedException) { return(Unauthorized()); } catch (SecurityNegotiationException) { return(Unauthorized()); } }
public void ReconnectService(bool forceReconnect) { if (service == null || forceReconnect) { service = new DynamicsService(currentConnectionString); } else { service.ConnectionString = currentConnectionString; } }
public IHttpActionResult UpdateBulkEmailForContact(string contactId, [FromUri] DynamicsCredentials credentials) { try { crmService = new DynamicsService(credentials); crmService.ChangeBulkEmail(contactId); return(Ok()); } catch (MessageSecurityException) { return(Unauthorized()); } catch (SecurityAccessDeniedException) { return(Unauthorized()); } }
public IHttpActionResult GetContacts(string listId, [FromUri]DynamicsCredentials credentials, [FromUri] string[] fields, [FromUri] int top = 0, [FromUri] bool translate = true) { try { crmService = new DynamicsService(credentials); var contacts = crmService.GetContactsInList(listId, fields, top); var goodLookingContacts = GetValuesFromContacts(contacts, translate, fields); return Ok(goodLookingContacts); } catch (MessageSecurityException) { return Unauthorized(); } catch (SecurityAccessDeniedException) { return Unauthorized(); } }
public IHttpActionResult GetContacts(string listId, [FromUri] DynamicsCredentials credentials, [FromUri] string[] fields, [FromUri] int top = 0, [FromUri] bool translate = true) { try { crmService = new DynamicsService(credentials); var contacts = crmService.GetContactsInList(listId, fields, top); var goodLookingContacts = GetValuesFromContacts(contacts, translate, fields); return(Ok(goodLookingContacts)); } catch (MessageSecurityException) { return(Unauthorized()); } catch (SecurityAccessDeniedException) { return(Unauthorized()); } }
public IHttpActionResult GetContactFields([FromUri]DynamicsCredentials credentials) { if (!ModelState.IsValid) { return Unauthorized(); } try { crmService = new DynamicsService(credentials); var attributes = crmService.GetAttributeDisplayName("contact"); return Ok(attributes); } catch (MessageSecurityException) { return Unauthorized(); } catch (SecurityAccessDeniedException) { return Unauthorized(); } }
public IHttpActionResult GetContactFields([FromUri] DynamicsCredentials credentials) { if (!ModelState.IsValid) { return(Unauthorized()); } try { crmService = new DynamicsService(credentials); var attributes = crmService.GetAttributeDisplayName("contact"); return(Ok(attributes)); } catch (MessageSecurityException) { return(Unauthorized()); } catch (SecurityAccessDeniedException) { return(Unauthorized()); } }
public IHttpActionResult GetMarketLists([FromUri]DynamicsCredentials credentials, [FromUri] bool translate = false) { if (!ModelState.IsValid) { return Unauthorized(); } try { crmService = new DynamicsService(credentials); var lists = crmService.GetAllMarketLists(); var goodLookingLists = GetValuesFromLists(lists, translate); return Ok(goodLookingLists); } catch (MessageSecurityException) { return Unauthorized(); } catch (SecurityAccessDeniedException) { return Unauthorized(); } }
public IHttpActionResult ValidateCredentials([FromUri]DynamicsCredentials credentials) { if (!ModelState.IsValid) { return Unauthorized(); } try { if (!string.IsNullOrEmpty(credentials.Domain)) { crmService = new DynamicsService(credentials); } else { //Will create service and try to fetch all lists to validate new DynamicsService(credentials).GetAllMarketLists(); } return Ok(); } catch (MessageSecurityException) { return Unauthorized(); } catch(SecurityAccessDeniedException) { return Unauthorized(); } catch (SecurityNegotiationException) { return Unauthorized(); } }
public IHttpActionResult UpdateBulkEmailForContact(string contactId, [FromUri]DynamicsCredentials credentials) { try { crmService = new DynamicsService(credentials); crmService.ChangeBulkEmail(contactId); return Ok(); } catch (MessageSecurityException) { return Unauthorized(); } catch (SecurityAccessDeniedException) { return Unauthorized(); } }
public IHttpActionResult GetOrganizations([FromUri]DynamicsCredentials credentials) { if (!ModelState.IsValid) { return Unauthorized(); } try { crmService = new DynamicsService(credentials); var organizations = crmService.GetOrganizations().Select(o => new { o.UniqueName, o.FriendlyName }); return Ok(organizations); } catch (MessageSecurityException) { return Unauthorized(); } catch (SecurityAccessDeniedException) { return Unauthorized(); } }
public override void LogPackageDeployment() { var service = new DynamicsService(ConnectionString); service.LogPackageDeployment(System.IO.Path.GetFileName(PackageLocation)); }
public override bool IsPackageDeployed() { var service = new DynamicsService(ConnectionString); return service.IsPackageDeployed(System.IO.Path.GetFileName(PackageLocation)); }