Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to make an add in for outlook using a C# VTSO. I would like to make a button on the UI in outlook that I would press after selecting a certain email and any attachments inside of that email would be sent to a newly created directory that would be named after the current date (mmddyyyy) + the subject of the email. This is for organizational purposes and better workflow for the influx of emails I am receiving for my projects.

What I have tried:

I've tried messing with the code and googling has gotten me this far.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.Office.Tools.Ribbon;
using System.Net.Mail;

namespace AttachmentSolution
{
    public partial class Ribbon1
    {
        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {
           
        }

        private void Button1_Click(object sender, RibbonControlEventArgs e)
        {
            string locationToCreateFolder = "D:/Attachments/";
            string folderName = "";
            string date = DateTime.Now.ToString("ddd MM.dd.yyyy");
            string format = "{0} on {1} At {2}";
            folderName = string.Format(format, date, Message.Subject);
            Directory.CreateDirectory(locationToCreateFolder + folderName);
            MessageBox.Show("done");
        }
    }
}


I made a ribbon with a button inside of it and this code is what is connected to it. I don't know what approach I should take at selecting the emails I need and how to implement that into the code I currently have.
Posted
Updated 25-Jun-19 9:33am

1 solution

 
Share this answer
 
Comments
Maciej Los 26-Jun-19 15:57pm    
Short And To The Point!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900