We're sorry Containerize doesn't work properply without JavaScript enabled.

Open Source Software Forum

Attachments not coming through when using GraphClient

I’m working to migrate some existing code to use the Aspose.Email.Clients.Graph.GraphClient email client. I’m finding I’m not seeing attachments sent/delivered when the email is sent. As a troubleshooting step, I’ve saved the email message to disk and can see the attachment. The below represents the code I’m working with. I’ve worked with our IT staff and I can’t see any reason why the attachment would be dropped. Is there something I’m missing? Setting headers, etc.?

                        Attachment myattachment = new Attachment(string.Concat(singlefilename, (docformat ? ".doc" : ".docX")));
                        MailMessage mymessage = new MailMessage();
                        mymessage.Attachments.Add(myattachment);

                        mymessage.To = emailaddress;
                        mymessage.From = fromemail;
                        mymessage.Subject = emailsubject;
                        MapiMessage mm = MapiMessage.FromMailMessage(mymessage);

                        AccessTokenProvider tokenProvider = new AccessTokenProvider(sPWD);
                        IGraphClient msgraphClient = GraphClient.GetClient(tokenProvider, tenantid);
                        msgraphClient.Resource = ResourceType.Users;
                        msgraphClient.ResourceId = fromemail;
                        msgraphClient.Send(mm,true);

This topic has been moved to the related forum: https://forum.aspose.com/t/attachments-not-coming-through-when-using-graphclient/268247