Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to code to transfer all Bookmarks from our browser to a Text file using c# windows form application including all parent folders.
Posted

For FF try following Link(i have not tested it)
http://stackoverflow.com/questions/945537/read-firefox-bookmarks-using-c[^]

For IE code below should do the work

C#
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Favorites);
            string[] bookmark = Directory.GetFiles(folderPath);
            foreach (string s in bookmark)
            {
                Console.WriteLine("Bookmark Address:={0}", s);
            }
            string[] folderList = Directory.GetDirectories(folderPath);
            if (folderList != null)
            {
                foreach (string f in folderList)
                {
                    bookmark = Directory.GetFiles(f);
                }
                foreach (string s in bookmark)
                {
                    Console.WriteLine("Bookmark Address:={0}", s);
                }
            }


It will give you the .url links. if you want the exact link to website stored there you can read the URL files and look for BASEURL="http://somethinglikethis.com"
[Update]
The Bookmark in chrome is stored @ ..\Local Settings\Application Data\Google\Chrome\User Data\Default in a file called bookmark.And you can get the information by parsing the file. You can use the JSON lib for deserializing the data read.
You can download JSON from http://json.codeplex.com/releases/view/64935[^] and use the following program as reference
http://studioshorts.com/blog/2011/06/reading-google-chrome-bookmarks-with-c-net/[^]
[/Update]
Hope this helps.
 
Share this answer
 
v3
Comments
sk saini 15-Jun-11 23:54pm    
Google chrome
CS2011 16-Jun-11 0:00am    
Hold one will update the solution in some time
RakeshMeena 16-Jun-11 0:25am    
My 5!
CS2011 16-Jun-11 0:26am    
Thanks
This is strictly application-dependent. Each browser has its own ways which are usually documented. Please address the Web site of the browser(s) you want to use.

—SA
 
Share this answer
 

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