web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

How to clear the body of an email which has been sent without changing its SentOn timestamp?

(1) ShareShare
ReportReport
Posted on by 5

In order to recoup some storage, we want to clear the description of some email records which have already been sent, 

The aim is to retrain the emails in the activity feed with the relevant data such as subject, sent, etc. but without the body.

I tried opening the email, updating the description and setting the state back to Sent, but this updates the Sent date.

Does anyone have any idea how to achieve this?

                IOrganizationService svc = service;
                var email = svc.Retrieve(Email.EntityLogicalName, Guid.Parse(""), new ColumnSet(true));
                var senton = email.Attributes["senton"]; // 2020/01/01
                svc.Execute(new SetStateRequest {
                    EntityMoniker = email.ToEntityReference(),
                    Status = new OptionSetValue {
                        Value = (int)email_statuscode.Draft
                    },
                    State = new OptionSetValue { Value = (int)EmailState.Open }
                });
                var update = new Entity(Email.EntityLogicalName, email.Id);
                update.Attributes["description"] = "";
                svc.Execute(new UpdateRequest { Target = update });
                svc.Execute(new SetStateRequest {
                    EntityMoniker = email.ToEntityReference(),
                    Status = new OptionSetValue {
                        Value = (int)email_statuscode.Sent
                    },
                    State = new OptionSetValue { Value = (int)EmailState.Completed }
                });
                email = svc.Retrieve(Email.EntityLogicalName, Guid.Parse(""), new ColumnSet(true));
                senton = email.Attributes["senton"]; // date is set to "Now". How to keep the original date?

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 144 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 59

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans