-
Notifications
You must be signed in to change notification settings - Fork 54
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Hi,
I am trying to create an email, but I can't because this error is shown to me
```
public bool SendEmail(Guid fromQueue, List recipients, string subj, string description)
{
try
{
ActivityParty fromParty = new ActivityParty
{
PartyId = new EntityReference(Queue.EntityLogicalName, fromQueue)
};
Email email= new Email
{
To = recipients.Select(r => new ActivityParty { AddressUsed = r }),
From = new ActivityParty[] { fromParty },
Subject = subj,
Description = description,
DirectionCode = true
};
using (var service = crmConnection.GetService())
{
Guid emailId = Guid.Empty;
try
{
emailId = service.Create(email);
}
catch (Exception ex)
{
return false;
}
if (emailId != Guid.Empty)
{
var emailRequest = new SendEmailRequest
{
EmailId = emailId,
TrackingToken = "",
IssueSend = true
};
var emailResponse = (SendEmailResponse)service.Execute(emailRequest);
if (emailResponse != null && emailResponse.Results != null && emailResponse.Results.Count > 0)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
}
catch (Exception ex)
{
return false;
}
}
}
}
I try to add EntityCollection
Create a new EntityCollection to add the party
```
EntityCollection from = new EntityCollection();
// Create activity party linked to account (from)
Entity apEntity = new Entity("activityparty");
apEntity.Attributes["partyid"] = new EntityReference("systemuser", fromQueue);
from.Entities.Add(apEntity);
// Create email
Entity emailEntity = new Entity("email");
emailEntity.Attributes["subject"] = "Mail Subject GUID";
emailEntity.Attributes["from"] = from;`
But I still have the same issue
I am using Microsoft.PowerPlatform.Dataverse.Client 0.5.7 version
Edit
once I used the 0.4.19 version, it's working for me
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working