Hi all,
I'm in a great need, I hope someone can help me out.
My organization is needing to delete the attachments from the old emails to gain some space because it is on 100% of the storage, I had a workflow that was provided by microsoft that would delete these attachments by a on demand custom workflow BUT by microsoft's grace of updating versions, this plugin is no longer useful.
we're using Dynamics 365 and I really need a new plug-in to do this job, I can find these old e-mails, but I can't delete it right now.
Anyone can help?
Thanks in advance.
*This post is locked for comments
[quote][/quote]
Hi all,
I'm in a great need, I hope someone can help me out.
My organization is needing to delete the attachments from the old emails to gain some space because it is on 100% of the storage, I had a workflow that was provided by microsoft that would delete these attachments by a on demand custom workflow BUT by microsoft's grace of updating versions, this plugin is no longer useful.
we're using Dynamics 365 and I really need a new plug-in to do this job, I can find these old e-mails, but I can't delete it right now.
Anyone can help?
Thanks in advance.
Thanks for the suggestion.
Reduce Storage Space has been rejected from the XRMToolBox Pluginkit in it's current iteration. Looks like it hasn't been updated in a year.
Hi Joao,
Why not make use of the ready-to-go XrmToolBox plugin: Reduce Storage Space Usage
See: www.xrmtoolbox.com/.../BDK.XrmToolBox.StorageSpaceCleaner
Tried the CRM Email Workflow plugin 2.3
Showed all the prompts that it was working but the truth was revealed the next day when my storage usage ballooned to double it's size!
System jobs showing a failure of Storage Size Statistics Collection with the note: The async operation type '20' was not recognized as a valid value for the context of: Server.
Any help would be great.
HI, I tried to develop my own custom workflow, so I did this code, but I'm getting the same result.
below is my code, if anyone could help me, I'd be so happy =)
// <copyright file="WorkFlowActivityBase.cs" company="">
// Copyright (c) 2017 All Rights Reserved
// </copyright>
// <author></author>
// <date>2/3/2017 11:46:45 PM</date>
// <summary>Implements the WorkFlowActivityBase Workflow Activity.</summary>
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
// </auto-generated>
using System;
using System.Collections.ObjectModel;
// These namespaces are found in the Microsoft.Xrm.Sdk.dll assembly
// found in the SDK\bin folder.
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.Xrm.Sdk.Client;
using System.Activities;
using Microsoft.Xrm.Sdk.Workflow;
using System.ServiceModel;
namespace Deleta_Anexos.Deleta_Anexos
{
public partial class CustomWorkflow : CodeActivity
{
//private OrganizationServiceProxy _serviceProxy;
[RequiredArgument]
[Input("EMAIL")]
[ReferenceTarget("email")]
public InArgument<EntityReference> rEmail { get; set; }
public sealed class LocalWorkflowContext
{
internal IServiceProvider ServiceProvider
{
get;
private set;
}
internal IOrganizationService OrganizationService
{
get;
private set;
}
internal IWorkflowContext WorkflowExecutionContext
{
get;
private set;
}
internal ITracingService TracingService
{
get;
private set;
}
private LocalWorkflowContext()
{
}
internal LocalWorkflowContext(CodeActivityContext executionContext)
{
if (executionContext == null)
{
throw new ArgumentNullException("serviceProvider");
}
// Obtain the execution context service from the service provider.
this.WorkflowExecutionContext = (IWorkflowContext)executionContext.GetExtension<IWorkflowContext>();
// Obtain the tracing service from the service provider.
this.TracingService = (ITracingService)executionContext.GetExtension<ITracingService>();
// Obtain the Organization Service factory service from the service provider
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)executionContext.GetExtension<IOrganizationServiceFactory>();
// Use the factory to generate the Organization Service.
this.OrganizationService = factory.CreateOrganizationService(this.WorkflowExecutionContext.UserId);
}
internal void Trace(string message)
{
if (string.IsNullOrWhiteSpace(message) || this.TracingService == null)
{
return;
}
if (this.WorkflowExecutionContext == null)
{
this.TracingService.Trace(message);
}
else
{
this.TracingService.Trace(
"{0}, Correlation Id: {1}, Initiating User: {2}",
message,
this.WorkflowExecutionContext.CorrelationId,
this.WorkflowExecutionContext.InitiatingUserId);
}
}
}
protected override void Execute(CodeActivityContext executionContext)
{
try
{
ITracingService tracingService = executionContext.GetExtension<ITracingService>();
//Create the context
IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
IOrganizationService IOS = serviceFactory.CreateOrganizationService(context.UserId);
QueryExpression _attachmentQuery = new QueryExpression
{
EntityName = "activitymimeattachment",
ColumnSet = new ColumnSet("activitymimeattachmentid"),
Criteria = new FilterExpression
{
Conditions =
{
new ConditionExpression
{
AttributeName = "activityid",
Operator = ConditionOperator.Equal,
Values = {rEmail.Get(executionContext).Id}
},
new ConditionExpression
{
AttributeName = "objecttypecode",
Operator = ConditionOperator.Equal,
Values = { rEmail.Get(executionContext).LogicalName }
}
}
}
};
EntityCollection results = IOS.RetrieveMultiple(
_attachmentQuery);
for (int j = 0; j < results.TotalRecordCount; j++)
{
IOS.Delete("activitymimeattachment", results[j].Id);
}
}
catch (FaultException<OrganizationServiceFault> ex) { throw new FaultException("Erro Fault Exception: " + ex.Message); }
catch (System.TimeoutException ex) { throw new TimeoutException("TimeOut Exception : " + ex.Message); }
catch (Exception e) { throw new InvalidPluginExecutionException("Error occurred: " + e.Message, e); }
}
}
}
I tried this one, the version 2.xx
if you use the CRM 2016 version of the release it should work
I tried to do as he said but it did not work, I believe that it lost the compatibility with Dynamics 365, = (
you need to import the solution and create an ondemand workflow to launch against the emails,
this post community.dynamics.com/.../55551
stoffg reply (near the end) has all the steps
I'm sorry, but how should I use this solution?
this custom activity should work
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,240 Super User 2024 Season 2
Martin Dráb 230,149 Most Valuable Professional
nmaenpaa 101,156