Rectangle 27 1

Non-recursive BFS with a single list (particular example is searching for *.eml files):

final FileFilter filter = new FileFilter() {
        @Override
        public boolean accept(File file) {
            return file.isDirectory() || file.getName().endsWith(".eml");
        }
    };

    // BFS recursive search
    List<File> queue = new LinkedList<File>();
    queue.addAll(Arrays.asList(dir.listFiles(filter)));

    for (ListIterator<File> itr = queue.listIterator(); itr.hasNext();) {
        File file = itr.next();
        if (file.isDirectory()) {
            itr.remove();
            for (File f: file.listFiles(filter)) itr.add(f);
        }
    }

Recursively list files in Java - Stack Overflow

java file recursion java-7 nio
Rectangle 27 2

It depends on the specific format, because according to this post, .eml files may or may not conform to a standard. However, the user points out that one standard is described by RFC 822.

That being said, according to the Gmail API documentation, the raw field looks like it contains what you need:

The entire email message in an RFC 2822 formatted and base64url encoded string.

java - How to save gmail message as .eml - Stack Overflow

java gmail gmail-api
Rectangle 27 2

Sub UpdatedQMISReply()
    Dim msg1 As String, msg2 As String
    Dim doc As Object, sel As Object
    Dim Location, Location2

    msg1 = "Please enter the UNC (http://) path for the new file"
    msg2 = "Please enter the QMIS path for the new file"

    Location = InputBox(msg1, "UNC location")
    Location2 = InputBox(msg2, "UNC location")

    Set doc = ActiveInspector.WordEditor
    Set sel = doc.Application.Selection

    With sel
        .TypeText Text:="Dear User,"
        .TypeParagraph
        .TypeParagraph
        .TypeText Text:="This email is to confirm that your recent " & _
                        "file update request to QMIS has now been " & _
                        "completed. I have uploaded all the requested " & _
                        "files and have saved a copy into the archive folder "
        .TypeText Text:="(if an old file existed)."
        .TypeParagraph
        .TypeParagraph
        .TypeText Text:="The location on QMIS for the uploaded document is: "

        .Hyperlinks.Add Anchor:=.Range, Address:=Location, SubAddress:="", ScreenTip:="", TextToDisplay:=Location2

        .TypeParagraph
        .TypeParagraph
        .TypeText Text:="If your update was concerning a Health & Safety " & _
                        "Document such as a Risk Assessment, or Safe System" & _
                        " of Work, then please note that the naming " & _
                        "convention for these documents is changing, also " & _
                        "the location of the document may change without " & _
                        "prior warning as the QMIS infrastructure is modified."
        .TypeParagraph
        .TypeParagraph
        .TypeText Text:="Should you have any further queries regarding " & _
                        "this update then please do not hesitate to contact me"
        .TypeParagraph
        .TypeParagraph
        .TypeText Text:="Regards"
    End With
End Sub

Alternatively in your actual code, replace

***ActiveInspector.WordEditor.Application.Selection.Hyperlinks.Add Anchor:=Selection.Range, Address:=Location, SubAddress:="", ScreenTip:="", TextToDisplay:=Location2***
ActiveInspector.WordEditor.Application.Selection.Hyperlinks.Add _
Anchor:=ActiveInspector.WordEditor.Application.Selection.Range, _
Address:=Location, SubAddress:="", ScreenTip:="", TextToDisplay:=Location2

Thanks but I get Run-time error '91': Object variable or With block variable not set

the set doc line, and if I replace doc on the line after with te stuff from the doc declaration (commenting the line out) I get the same error on the set sel line....

Set doc...
Set sel
With sel
With ActiveInspector.WordEditor.Application.Selection

I get the same result. It gives me the msgbox's I fill them in, and then it stops

VBA Office 2010 Outlook issues - Stack Overflow

vba outlook ms-office
Rectangle 27 3

Renaming your files to end with .eml (extension) with mmv which is available under FreeBSD, Mac OS X (Macports) and [your favourite distro] Linux.

Create a new folder and simply work with the contextmenu "Import all EML files from a directory".

email - how to import mails into thunderbird from maildir format - Sta...

email imap thunderbird
Rectangle 27 4

For what it's worth - I just came across this thread looking for the same export to individual .VCF files from outlook. I haev 2007 (don't know if that makes a difference) but I selected all contacts and dragged them to a new email message to be added as individual .VCF files. After they were all added, I clicked in the attachments section of the new email, hit CTRL-A to highlight all of them, then left-click-dragged the first (and therefore all of them) to the folder I wanted the individual .VCF files in. A few minutes of Outlook "thinking" about my 400 contacts they were all there!

c# - Export all contacts as vcards from Outlook - Stack Overflow

c# .net outlook vcard
Rectangle 27 1

This will save it as a csv. I'm not sure you really want a plain text file as you would lose all column structure..

ActiveWorkbook.SaveAs filename:="C:\Temp\" & ActiveSheet.name & ".csv", FileFormat:=xlCSV

Here is a function I wrote at some point to export a whole workbook. It puts each worksheet into it's own text file.

Sub SaveWorksheetsAsCsv()
Dim ws As Excel.Worksheet
Dim SaveToDirectory As String
Dim CurrentWorkbook As String
Dim CurrentFormat As Long
Dim cell As Range

    CurrentWorkbook = ThisWorkbook.FullName
    CurrentFormat = ThisWorkbook.FileFormat
    ' Store current details for the workbook
    SaveToDirectory = "C:\Temp\"

    For Each ws In ThisWorkbook.Worksheets

        'This was a check on the worksheet name for excluding some worksheets that I didn't want to export
        'If ws.name <> "Instructions" And ws.name <> "Parameters" And ws.name <> "BI Data & Worksheet" Then

            'This makes the current sheet its own workbook so it can be saved.
            Sheets(ws.name).Copy

            'Not sure what I was doing here
            'For Each cell In [b:b]
            'If cell.Value = "~" Then cell.ClearContents
            ''put any value you want here
            'Next cell


            ActiveWorkbook.SaveAs filename:=SaveToDirectory & ws.name & ".csv", FileFormat:=xlCSV
            ActiveWorkbook.Close SaveChanges:=False
            ThisWorkbook.Activate
        'End If
    Next

    Application.DisplayAlerts = False
    ThisWorkbook.SaveAs filename:=CurrentWorkbook, FileFormat:=CurrentFormat
    Application.DisplayAlerts = True
    ' Temporarily turn alerts off to prevent the user being prompted
    '  about overwriting the original file.
End Sub

Save Excel attachment as .txt - opened with a vba macro from Outlook 2...

excel vba outlook
Rectangle 27 1

If your CSV file is straightforward, without newlines or commas in unexpected places, then the standard *nix tool awk would be useful. It would allow you to easily extract the 15 columns you are looking for to a new CSV file. This blog post gives an explanation how to use it on CSV files.

Suppose that you want to extract columns 1, 3 and 7 from file.csv, then you could do this with the command

awk -F, '{print $1","$3","$7;}' file.csv

Your Windows machine probably does not have awk installed. There are a few options:

If you are parsing a more awkward CSV file, then check out parse csv file using gawk for a bunch of suggestions.

thank you so much!! but for education purposes, how is this done with vba or vbs? (if you know))))

@lalachka why did you accept this answer if you wanted vba or vbs? FWIW I like the approach, I've addded awk to the to do list

because i'm new here and i don't understand the rules 100%. i thought if the answer is correct - then it's an answer. but it's true, i wanted vba or vbs. i just didn't want to be rude to Reinier))))

@lalachka I would not perceive that as rude, since you explained your motivations. I can not speak for other people of course. However, in this case asking a new question sounds more appropriate to me. You are shifting from "how to handle a big CSV file" to "what is wrong with my code". You could cut the piece below your "Thank you" and use that as the new question. It is really up to what you want to do in the end. The users of this site together make up the unwritten rules of how to behave, and you are one of them.

vba - extract fields from a huge csv file and write them to a table, t...

vba ms-access csv vbscript
Rectangle 27 1

Because we have spaces in files name we need to enclose it by Chr(34) :

Sub Extract()

    Dim RarIt As String
    Dim Source As String
    Dim Desti As String
    Dim WinRarPath As String

    WinRarPath = "C:\Program Files\WinRar\"
    Source = "C:\Reports\EMEA Load.rar"
    Desti = "C:\Reports\"

    RarIt = Shell(Chr(34) & WinRarPath & "WinRar.exe" & Chr(34) & " e " & Chr(34) & Source & Chr(34) & " " & Chr(34) & Desti & Chr(34), vbNormalFocus)

End Sub

Extract .rar file in Vba Excel - Stack Overflow

excel vba excel-vba unrar
Rectangle 27 1

It's not quite what you want, but it's possible using modern javascript to create an EML file on the client and stream that to the user's file system, which should open a rich email containing HTML in their mail program, such as Outlook:

<!-- https://jsfiddle.net/seanodotcom/yd1n8Lfh -->
<textarea id="textbox" style="width: 300px; height: 600px;">
To: User <user@domain.demo>
Subject: Subject
X-Unsent: 1
Content-Type: text/html

<html>
<head>
<style>
    body, html, table {
        font-family: Calibri, Arial, sans-serif;
    }
    .pastdue { color: crimson; }
    table {
        border: 1px solid silver;
        padding: 6px;
    }
    thead {
        text-align: center;
        font-size: 1.2em;
        color: navy;
        background-color: silver;
        font-weight: bold;
    }
    tbody td {
        text-align: center;
    }
</style>
</head>
<body>
<table width=100%>
    <tr>
        <td><img src="http://www.laurell.com/images/logo/laurell_logo_storefront.jpg" width="200" height="57" alt=""></td>
        <td align="right"><h1><span class="pastdue">PAST DUE</span> INVOICE</h1></td>
    </tr>
</table>
<table width=100%>
    <thead>
        <th>Invoice #</th>
        <th>Days Overdue</th>
        <th>Amount Owed</th>
    </thead>
    <tbody>
    <tr>
        <td>OU812</td>
        <td>9</td>
        <td>$4395.00</td>
    </tr>
    <tr>
        <td>OU812</td>
        <td>9</td>
        <td>$4395.00</td>
    </tr>
    <tr>
        <td>OU812</td>
        <td>9</td>
        <td>$4395.00</td>
    </tr>
    </tbody>
</table>
</body>
</html>
</textarea> <br>
<button id="create">Create file</button><br><br>
<a download="message.eml" id="downloadlink" style="display: none">Download</a>
(function () {
var textFile = null,
  makeTextFile = function (text) {
    var data = new Blob([text], {type: 'text/plain'});
    if (textFile !== null) {
      window.URL.revokeObjectURL(textFile);
    }
    textFile = window.URL.createObjectURL(data);
    return textFile;
  };

  var create = document.getElementById('create'),
    textbox = document.getElementById('textbox');
  create.addEventListener('click', function () {
    var link = document.getElementById('downloadlink');
    link.href = makeTextFile(textbox.value);
    link.style.display = 'block';
  }, false);
})();

email - MailTo with HTML body - Stack Overflow

html email outlook exchange-server mailto
Rectangle 27 1

It's not quite what you want, but it's possible using modern javascript to create an EML file on the client and stream that to the user's file system, which should open a rich email containing HTML in their mail program, such as Outlook:

<!-- https://jsfiddle.net/seanodotcom/yd1n8Lfh -->
<textarea id="textbox" style="width: 300px; height: 600px;">
To: User <user@domain.demo>
Subject: Subject
X-Unsent: 1
Content-Type: text/html

<html>
<head>
<style>
    body, html, table {
        font-family: Calibri, Arial, sans-serif;
    }
    .pastdue { color: crimson; }
    table {
        border: 1px solid silver;
        padding: 6px;
    }
    thead {
        text-align: center;
        font-size: 1.2em;
        color: navy;
        background-color: silver;
        font-weight: bold;
    }
    tbody td {
        text-align: center;
    }
</style>
</head>
<body>
<table width=100%>
    <tr>
        <td><img src="http://www.laurell.com/images/logo/laurell_logo_storefront.jpg" width="200" height="57" alt=""></td>
        <td align="right"><h1><span class="pastdue">PAST DUE</span> INVOICE</h1></td>
    </tr>
</table>
<table width=100%>
    <thead>
        <th>Invoice #</th>
        <th>Days Overdue</th>
        <th>Amount Owed</th>
    </thead>
    <tbody>
    <tr>
        <td>OU812</td>
        <td>9</td>
        <td>$4395.00</td>
    </tr>
    <tr>
        <td>OU812</td>
        <td>9</td>
        <td>$4395.00</td>
    </tr>
    <tr>
        <td>OU812</td>
        <td>9</td>
        <td>$4395.00</td>
    </tr>
    </tbody>
</table>
</body>
</html>
</textarea> <br>
<button id="create">Create file</button><br><br>
<a download="message.eml" id="downloadlink" style="display: none">Download</a>
(function () {
var textFile = null,
  makeTextFile = function (text) {
    var data = new Blob([text], {type: 'text/plain'});
    if (textFile !== null) {
      window.URL.revokeObjectURL(textFile);
    }
    textFile = window.URL.createObjectURL(data);
    return textFile;
  };

  var create = document.getElementById('create'),
    textbox = document.getElementById('textbox');
  create.addEventListener('click', function () {
    var link = document.getElementById('downloadlink');
    link.href = makeTextFile(textbox.value);
    link.style.display = 'block';
  }, false);
})();

email - MailTo with HTML body - Stack Overflow

html email outlook exchange-server mailto
Rectangle 27 1

You can use an Access "append query" with your worksheet as its data source. That way you can import only the columns you need, and you can also extract the date from the workbook file name and use it for a query parameter.

In this example, I import only one XLSX file. My Access destination table, "FD_Worksheet_master", includes a Date/Time field named "file_date". And the Excel data I want to import is in a worksheet named "Sheet1".

Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim astrPieces() As String
Dim dteFileDate As Date
Dim strDir As String
Dim strFile As String
Dim strInsert As String

strDir = "C:\Users\hans\Documents\"
strFile = "FD Worksheet 01 06 2016.xlsx"

If Not strDir Like "*\" Then
    strDir = strDir & "\"
End If
strInsert = "INSERT INTO FD_Worksheet_master (file_date, Annual, Monthly, Hourly)" & vbCrLf & _
    "SELECT [which_date] as file_date, xl.Annual, xl.Monthly, xl.Hourly" & vbCrLf & _
    "FROM [Excel 12.0 Xml;HDR=YES;IMEX=2;DATABASE=" & strDir & strFile & "].[Sheet1$] AS xl;"
Debug.Print strInsert
astrPieces = Split(strFile, " ")
' Note: I assumed "01 06 2016" is "mm dd yyyy" format.
' If actually "dd mm yyyy", swap the order of astrPieces(2) and astrPieces(3)
dteFileDate = DateSerial(Val(astrPieces(4)), astrPieces(2), astrPieces(3))
Debug.Print dteFileDate
Set db = CurrentDb
Set qdf = db.CreateQueryDef(vbNullString, strInsert)
qdf.Parameters("which_date").Value = dteFileDate
qdf.Execute dbFailOnError

You may need to change the IMEX value; if 2 doesn't work, try 1.

Many thanks Hans! After a very small modification to your code, I managed to get it to work perfectly for me. It is now placing the date from the Excel file name into the 'file_date' field within the 'FD_Worksheet_master' table for every row in the original spreadsheet. From here, do you know how I would import the columns 'K', 'N', 'AO', and 'AP' from Sheet1 of the worksheet? I'm very new to MS Access VBA, so please forgive my lack of ability!

I used HDR=YES in the query's connection to the workbook because you had True for the HasFieldNames parameter with TransferSpreadsheet. So that means the field/column names/headers should be present in the first row of the worksheet. Look up the names for those columns and substitute those where I had xl.Annual, xl.Monthly, xl.Hourly in my query.

If I misunderstood your situation, and you don't have names/headers in the first spreadsheet row, make another query which is just SELECT * with your working FROM clause and HDR=NO. When you run that query, Access will assign names ... such as F1, F2, etc. ... to the columns. Find out which names correspond to the columns you want, and use those names in the main query.

Again Hans, your solution worked perfectly. I added my column names to the code and it brought everything in as I wanted.I will post my final code below. Thank you!

Adding a unique ID field to identify spreadsheets imported from differ...

excel vba ms-access import access-vba
Rectangle 27 1

mail files are usually stored in rfc822 format which is used by most mail clients and covers all your requirements. instead of putting them alle in a single a mbox file you might want to consider using one file per mail which makes it faster to restore a single mail (you can easily search based on file time for example) rfc822 mail files usually have a ".eml" ending

php - Email File Format Options for backups - Stack Overflow

php email mbox
Rectangle 27 0

You can construct javax.mail.Message object (or have it already constructed from the mail server) and then you can use writeTo() method to save it to file. See JavaMail API for more information.

... package javax.mail does not exist

@Supuhstar - Old thread but for anyone else reading this, this relies on the javamail API.

Create a .eml (email) file in Java - Stack Overflow

java email outlook eml
Rectangle 27 0

EML files are just plain text files. The headers are separated from the body by a blank line. Headers look like this:

From: "DR CLEMENT OKON" <drclement@nigerianspam.com>
To: "You" <you@yourdomain.com>
Subject: REQUEST FOR URGENT BUSINESS RELATIONSHIP 
Date: Tue, 30 Sep 2008 09:42:47 -0400

For more info, the official spec is RFC 2822. It's actually not as hard to read as some RFCs.

Edit: When I said "plain text" I should have thought for a second. I really meant plain ASCII - and not the 8-bit "extended ASCII" either - just up to character 127. If you want more than seven bits, you need some kind of encoding and things get complicated.

Create a .eml (email) file in Java - Stack Overflow

java email outlook eml
Rectangle 27 0

Looking at a typical EML file it looks like a raw dump of the text communication that went to the server. So it is a text file containing the mail headers and body. To get your attachments, different views, etc in the correct format inside the EML file you need to MIME-encode the body and its parts.

Create a .eml (email) file in Java - Stack Overflow

java email outlook eml
Rectangle 27 0

Yes, saving the attachment data to a temporary file and reading it s the only way. In theory, you can use Attachment.PropertyAccessor.GetProperty to read the PR_ATTACH_DATA_BIN property, but you will run into problems for the large (> 64kB) files.

You can also use Extended MAPI to open the attachment data as IStream (IAttach::OpenProperty(PR_ATTACH_DATA_BIN, IID_IStream)), but it is only accessible through C++ or Delphi. You can use Redemption (any language) that wraps Extended MAPI and exposes AsArray and AsText properties on both RDOAttachment and the Attachment object exposed by the Safe*Item objects.

Read Outlook attachment content in Outlook add-in (C# ) while creating...

c# outlook outlook-addin outlook-2007
Rectangle 27 0

You could create an .eml file and open it which should give you the effect you want as long as there is any email client registered in the system to handle files with this extension. I'm sure this is not as universal as the mailto: scheme but if mailto: does not work for you I think this could be the second best option to try.

Since EML files are created to comply with the industry RFC 822 standard, they can be used with most e-mail clients, servers and applications. Besides the Microsoft Outlook Express, EML files can be opened using most e-mail clients, such as Microsoft Outlook, Microsoft Entourage, Mozilla Thunderbird, Apple Mail, and IncrediMail.

Side note When I click 'E-mail' in Picasa I get dialog where I can choose which application (Thunderbird or Google Mail) I want to send email with. This means Picasa knows specific email client being used to send email and can use custom method, specific to chosen email client, to send email. This is of course just speculation but it might be that Picasa makes user to choose email client because there's no generic way to do what you ask about.

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

c++ - Send email with attachment using client's email application - St...

c++ qt email attachment mailto
Rectangle 27 0

Dim fso As New FileSystemObject
     Dim fldr As Folder
     Dim file1 As File

     Dim objApp As Object
     Set objApp = CreateObject("Shell.Application")
     objApp.Namespace(Destinationfolder &"\").CopyHere (objApp.Namespace(Zippedfilepath).Items)
     Set fldr = fso.GetFolder(Destinationfolder)

     For Each file1 In fldr.Files
         If file1.Type <> "Microsoft Excel Worksheet" Then
            file1.Delete
         End If
    Next

Hi, The link will only extract the zip files but I need only the excel files to be extracted from multiple zip files.

VBA code to extract Excel files from Multiple zip files - Stack Overfl...

excel-vba
Rectangle 27 0

You can use Redemption for that. Something like the following (off the top off my head) should work:

RDOSession Session = new RDOSession();
  RDOMail Msg = Session.GetMessageFromMsgFile("c:\temp\YourMsgFile.msg");
  Msg.SaveAs("c:\temp\YourEmlFile.eml", rdoSaveAsType.olRFC822);

c# - 3rd party utility to convert Outlook MSG files to EML files - Sta...

c# asp.net outlook eml msg
Rectangle 27 0

No, you cannot do that for an EML file. Why not create an MSG file? Then setting the account is a matter of setting a couple of MAPI properties.

What programming language are you using? Is Outlook installed on the machine where your code is running?

if you need to create an MSG file, your choices are

  • Outlook Object Model - call MailItem.SaveAs(..., olMsg) if you have an existing message in one of the Outlook folders.
  • Create the MSG file programmatically - it format is documented.
  • In case of C++ or Delphi, you can use Extended MAPI (OpenImsgOnIStg etc.)
  • Redemption and its RDOSession.CreateMessageFromMsgFile method (returns RDOMail object that yo ucan use to set various properties and call RDOMail.Save).

I'm using C# and yes currently outlook is installed in the machine. But I'm looking for a solution without using Office APIs. Yes we can use MSG file. So can you guide me on how to set MAPI properties?

Can I use the 4th point (Redemption) for MVC (web based) project? Hope I can configure the MSG file to use the default mail account in outlook.

Yes, you can use RDOSession.CreateMessageFromMsgFile under IIS as long as Outlook is installed locally (since Redemption needs the MAPI system to function). When setting outgoing account, does it need to be set to an SMTP account or a GAL user?

asp.net mvc - How to assign default From Account in eml files using c#...

c# asp.net-mvc email outlook eml