Get Outlook folders icons - c#

I am building an add-in which requires selection of multiple outlook folders. For that purpose I created selection dialog that lists folders and allows user to select one or more by checking the check boxes next to tree view items.
I was hoping that somehow I could read/get the outlook folder icons from my add in code which is written in C# (any solution that works with outlook object model would do).
I was trying hard around MAPIFolder.GetCustomIcon but it returns null for all folders and when you read the documentation it is clear that it is not meant for this i.e. it returns value only if folder has custom icon and if it is not any of default folders.
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mapifolder.getcustomicon%28v=office.14%29.aspx
Thanks for reading.

You'll have to use an icon editing tool (like Axialis Icon Workshop) that can extract icon and image resources from related Outlook .dll and .exe files. It's a real mess to figure out what icon is where there as they exist in small and large quantities in very many different files.

Related

Drag and Drop from ListView to Explorer [duplicate]

This question already has answers here:
Drag Drop from .NET application to Explorer
(2 answers)
Closed 7 years ago.
My goal is to able to drag an item from a ListView to Explorer. The way I'm trying to accomplish this is somewhat different though. From searching Google and around this site, I couldn't really find anything that would help me or pertained closely enough to what I'm trying to do. I can barely comprehend some of the examples because I don't understand enough about these drag and drop operations.
Specifically, the control that I'm trying to drag items from is a TreeListView from the ObjectListView library. The control is populated with nodes that represent the structure inside a archive-like compressed file. Entries are parsed into two different objects representing a file and a directory. Both of these models inherit an interface. When extracting these files normally, I use a Form that I instantiate with a collection of nodes and the target path that they will be extracted to as the parameters. It then takes care of extraction. This is so that I can show the overall and singular progress of each file.
Subscribing to the ItemDrag event, I know that I need to call DoDragDrop. When doing this, I need to be able to instantiate the extraction form only after the drop (when the user releases the mouse) into Explorer, and also be able to retrieve the path in which the items were dragged.
For some reason, this seems a lot more complicated than it should be. Any sort of advice or suggestions would be very helpful.
I'm not sure what format Explorer expects in the drag object, but this process might work for you.
When you begin the drag, pre-extract the selected files to some temp
directory
Build a DataObject which contains the paths of the files you have extracted in the format expected by Explorer
Use your DataObject in the DoDragDrop call
When the user drops on Explorer, the files should get copied from the temp directory to the drop target
Track all of your extracted files and cleanup when the application exists (id desired)
Hope this helps.
Edit (after some research):
I believe if you use
new DataObject(DataFormats.FileDrop, files)
where files is a string[] of the filenames to be copied (the ones you put in the temp directory), you shouold have the correct DataObject for implementation.
Haven't had a chance to write a prototype yet to test. Good Luck!

How to populate a row of buttons with folders?

I'm very new to making visual programs and pretty new to C# to begin with.
I'm attempting to make a file browser that opens up files as well; I have several other questions but I'll just start with one.
I'm trying to populate a list of tabs/buttons across the top of the program with folders under a directory, and then when you click on one of the tabs it will change the tree view to show that directory (and sub-directories/files.)
I've got the file browser working- still working on opening files but I believe I got most of that done. I just need to figure out how to make these tabs.
EDIT: This is a windows application being created though VS Express.

How to build a search engine in windows form that searches for folders in C drive using C#

I'm making a documentation program and I built a search engine with text boxes,combo boxes,and check list boxes. I haven't written a code that actually does the searching, there are just buttons and the components.
Anyways the files I want to access are in one folder in the C drive and in that folder there are many other folders and subfolders. I want the user to either type in the desired name of the folder,or select from a combo box.Normally we can open a folder with this code:
Process.Start(#"C:\Users\melek\Desktop\svn");
I don't want to write Users\melek etc each time in code. I need a code that grabs the users selected folder or file name(using combo boxes and text boxes) and find the folder and display it in windows form.
Is it possible to convert the selection from the text box or combo box to string and use the Process.Start command?
We solved this problem like this:
we obtained a path and used this code:
listBox1.DataSource = System.IO.Directory.GetFileSystemEntries(path1);
What you're trying to do requires several steps, so let's discuss them in turn.
First you need to get a path from the user so your program knows where to search . A FolderBrowserDialog attached to a button provides this. No need to hard code any paths since you can fetch the path string from this dialog.
Next you can use the Path, Directory and File classes to perform operations such as, fetching a list of all subfolders from a path, extracting paths of paths as strings for additional searching, and checking properties or flags on files and folders in case you decide to support more advanced search options.
I would suggest understanding these core file system classes more if you're going to be doing any amount of development that interacts with the file system. They are your bread and butter. I've linked to the MSDN documentation for each, for your convenience.

How to get selected items from window desktop?

I need to obtain selected items located in a window desktop (files and folders) in current moment. I know how to obtain selected items in window explorer using shell32 object and how to get just all desktop items. But how to find out which of them are selected in current moment I don't know.
I find code snippet in question Get selected items of folder with WinAPI. It probably allows to get selected items in desktop but I think that this is hack style code and it can deliver problems on other versions of OS.
UPDATE:
I obtain solution but I have problems yet. The problem is that if I create for example 2 files, file1.txt and file1.doc and I set view option "don't show extensions of registered files" then all extensions are removed and I can't obtain what exactly file was selected because I receive only names of files (file1 and file1 without any information). Method gives results without extension. So can anyone know how to solve it?

silverlight - file extensions

I am working on a file explorer using Silverlight OOB. I need a way to get and display the icon associated with each file in my application. Note, I only need to show the icons, I donĀ“t need to open the files.
If I understood you right, you're building something like Windows Explorer and want to mimic its list view by showing the program icons right before their names.
I'm not sure whether OOB has access to the System.Drawing.Icon class, but if so, you can use the following code to get the icon for any given file:
Bitmap icon = System.Drawing.Icon.ExtractAssociatedIcon(filename).ToBitmap();
If not, the only way you can do it is by storing the icons for most common file formats in a dictionary and retrieving them from there based upon file extension.

Categories