Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 707749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:18:48+00:00 2026-05-14T04:18:48+00:00

I developp a Java application using Windows Desktop Search from which I can retrieve

  • 0

I developp a Java application using Windows Desktop Search from which I can retrieve some information about files on my computer such as urls (System.ItemUrl). An example of such url is

file://c:/users/ausername/documents/aninterestingfile.txt

for “normal” files. This field give also urls of mail items indexed from Outlook or Thunderbird. Thunderbird’s items (only available using vista and seven) are also files (.wdseml). But outlook’s items urls start with “mapi://” like :

mapi://{S-1-5-21-1626573300-1364474481-487586288-1001}/toto@mycompany.com($b423dcd5)/0/Inbox/가가가가곕갘객겒갨겑곓걌게겻겨곹곒갓곅갩갤가갠가

The problem I have is opening the real item from Java in Outlook using this url. If I copy/paste it in the run dialog of Windows, it works ; it also works if I use “start” followed by the copied/pasted url in command line.

The url seems to be encoded in UTF-16. I want to be able to write such code :

String url = "mapi://{S-1-5-21-1626573300-1364474481-487586288-1001}/toto@mycompany.com($b423dcd5)/0/Inbox/가가가가곕갘객겒갨겑곓걌게겻겨곹곒갓곅갩갤가갠가";

Runtime.getRuntime().exec("cmd.exe /C start " + url);

I doesn’t work and I’ve tried other solutions like :

String start = "start";
String url = "mapi://{S-1-5-21-1626573300-1364474481-487586288-1001}/toto@mycompany.com($b423dcd5)/0/Inbox/가가가가곕갘객겒갨겑곓걌게겻겨곹곒갓곅갩갤가갠가";

FileOutputStream fos = new FileOutputStream(new File("test.bat");
fos.write(start.getBytes("UTF16");
fos.write(url.getBytes("UTF16"));
fos.close();

Runtime.getRuntime().exec("cmd.exe /C test.bat");

without any success. Using the solution above, the file “test.bat” contains the correct url and the “start” command, but the run of “test.bat” results in the well known error message :

'■' is not recognized as an internal or external command, operable program or batch file.

Has anybody an idea to be able to open “mapi://” items from Java ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:18:48+00:00Added an answer on May 14, 2026 at 4:18 am

    Well, my question was a little bit tricky. But I finally found an answer and will share it here.

    What I suspected was true : Windows uses UTF-16 (little endian) urls. It makes no differences working in UTF-8 when we only use paths to files such as images, text, etc. But to be able to access Outlook items, we must use UTF-16LE. If I were coding in C#, there wouldn’t have been any problem. But in Java, you have to be more inventive.

    From Windows Desktop Search, I retrieve this:

    mapi://{S-1-5-21-1626573300-1364474481-487586288-1001}/toto@mycompany.com($b423dcd5)/0/Inbox/가가가가곕갘객겒갨겑곓걌게겻겨곹곒갓곅갩갤가갠가
    

    And what I did is creating a temporary VB script and run it like this:

    /**
     * Opens a set of items using the given set of paths.
     */
    public static void openItems(List<String> urls) {
      try {
    
        // Create VB script
        String script =
          "Sub Run(ByVal sFile)\n" +
          "Dim shell\n" +
          "Set shell = CreateObject(\"WScript.Shell\")\n" +
          "shell.Run Chr(34) & sFile & Chr(34), 1, False\n" +
          "Set shell = Nothing\n" +
          "End Sub\n";
    
        File file = new File("openitems.vbs");
    
        // Format all urls before writing and add a line for each given url
        String urlsString = "";
        for (String url : urls) {
          if (url.startsWith("file:")) {
            url = url.substring(5);
          }
          urlsString += "Run \"" + url + "\"\n";
        }
    
        // Write UTF-16LE bytes in openitems.vbs
        FileOutputStream fos = new FileOutputStream(file);
        fos.write(script.getBytes("UTF-16LE"));
        fos.write(urlsString.getBytes("UTF-16LE"));
        fos.close();
    
        // Run vbs file
        Runtime.getRuntime().exec("cmd.exe /C openitems.vbs");
    
      } catch(Exception e){}
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 505k
  • Answers 505k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Figured it out. The following inserts a relative reference to… May 16, 2026 at 3:30 pm
  • Editorial Team
    Editorial Team added an answer this and CRUD like this and read this AS SQL… May 16, 2026 at 3:30 pm
  • Editorial Team
    Editorial Team added an answer Haven't really solved this. But it's easier to read whatever's… May 16, 2026 at 3:30 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I develop a number of desktop Java applications using Swing, and while Swing is
I'm a web developer at day and thinking about building my first real desktop
We sell photoalbums which our customers create theirselves using a client album editor program
Is it possible to develop an android application aimed at mobile devices and also
On Windows/Linux platform,I as a common computer user,could not nearly find any software written
I am used to develop web applications in Java (Struts, Spring, JSP...). But now
I'm trying to find a programming language I feel really comfortable learning and using
Looking to develop server-side application that will process documents. The source documents are mostly
I need to develop an application with following features and want to understand if
I'm working on a project which includes persistence library (JPA 1.2), EJB 3 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.