Genesys CTI User Forum > Genesys-related Development

WDE 8.5 - Get Interaction ID or all message properties

<< < (2/2)

fabus:
Now I have another problem, because I cannot find content of attachments. It looks that content is empty "null". Is there any other option to save all attachments to disk?

[code]Genesyslab.Desktop.Modules.Core.Model.Interactions.IInteraction interaction = Model.Case.MainInteraction;
           
            if (interaction is IInteractionInboundEmail)
            {
                IInteractionInboundEmail email = interaction as IInteractionInboundEmail;
               
                foreach (var attachment in email.EntrepriseEmailAttachments)
                {
                    //Save to disk
                }[/code]

attachment values during debbuging
[img width=640 height=132]http://i57.tinypic.com/jahyxi.jpg[/img]

PeteHoyle:
[quote author=fabus link=topic=9139.msg41102#msg41102 date=1444125575]
Now I have another problem, because I cannot find content of attachments. It looks that content is empty "null". Is there any other option to save all attachments to disk?

[code]Genesyslab.Desktop.Modules.Core.Model.Interactions.IInteraction interaction = Model.Case.MainInteraction;
           
            if (interaction is IInteractionInboundEmail)
            {
                IInteractionInboundEmail email = interaction as IInteractionInboundEmail;
               
                foreach (var attachment in email.EntrepriseEmailAttachments)
                {
                    //Save to disk
                }[/code]

attachment values during debbuging
[img width=640 height=132]http://i57.tinypic.com/jahyxi.jpg[/img]
[/quote]

One way to get the Attachments if like this:

[code]                ICollection<IAttachment> attachments = email.EntrepriseEmailAttachments;
                foreach(IAttachment attachment in attachments)
                {
                    String id = attachment.Id;
                    String name = attachment.Name;
                }[/code]

But for performance reasons the content of the attachments is not retrieved, to get the content you would need to use something like:

IContactService.GetAttachment
or
Drop down to Platform SDK level and use the ContactServer RequestGetInteractionContent request.

But I have not done either of those before.

Why do you want to save the attachments locally?

fabus:
The reason is that in some cases I need to export email to eml file which could be opened in Outlook/Thunderbird etc...

Could you give me some tips how to use IContactService? I cannot found it in API refference. Is there any document regarding Enterprise SDK 8.5 framework?

PeteHoyle:
I haven't used it before either, but here is what I just put together..

[code]        private IAttachment GetAttachment(string attachmentId, DataSourceType dataSourceType)
        {
            Genesyslab.Enterprise.Services.IContactService contactService = container.Resolve<IEnterpriseServiceProvider>().Resolve<Genesyslab.Enterprise.Services.IContactService>("contactService");
            Genesyslab.Desktop.Modules.Core.SDK.Protocol.IChannelManager channelManager = container.Resolve<Genesyslab.Desktop.Modules.Core.SDK.Protocol.IChannelManager>();
            IClientChannel channel = channelManager.Register(container.Resolve<Genesyslab.Desktop.Modules.Core.SDK.Contact.IContactService>().UCSApp, "My@ContactService");
            if (channel != null && channel.State == ChannelState.Opened)
            {
                IAttachment attachment = contactService.GetAttachment(channel, attachmentId, dataSourceType, 20000);
                return attachment;
            }
            else
            {
                return (IAttachment)null;
            }

        }[/code]

Navigation

[0] Message Index

[*] Previous page

Go to full version