private void UpdateTranslation(Entity sourceItem, Entity targetItem) { Entity targetUpdate = new Entity(targetItem.LogicalName, targetItem.Id); targetUpdate["etel_message"] = sourceItem.Attributes["etel_message"].ToString(); using (var service = new DynamicsService(CredentialType.MasterDev)) { service.Update(targetUpdate); } }
private void CreateOrUpdate(Entity sourceItem) { try { using (var service = new DynamicsService(CredentialType.MasterDev)) { service.Create(sourceItem); } } catch (Exception) { using (var service = new DynamicsService(CredentialType.MasterDev)) { service.UpdateTranslation(sourceItem); } } }
private TranslationStack GetSourceTranslationList() { using (var service = new DynamicsService(CredentialType.Dev)) { var query = service.CreateQueryWithLastDays(LanguageCode.English, 10); var entityCollection = service.Execute(query); var querySpanish = service.CreateQueryWithLastDays(LanguageCode.Spanish, 10); var entityCollectionSpanish = service.Execute(querySpanish); return(new TranslationStack { TranslationEnglish = entityCollection, TranslationSpanish = entityCollectionSpanish }); }; }