Read bookmarks in outlook MSG file with C# -


my goal somehow able read bookmarks in outlook .msg file, replace them different text. want c#.

i know how access body , change text, wondering if there way access directly list of bookmarks , location can replace them, instead going through whole body text, splitting up, etc etc...

edit: this how bookmark window looks like window 1 can assign bookmarks, should possible obtain list via c#.

enter image description here

any relevant info appreciated. in advance.

since outlook most uses word it's body editor - need add project reference microsoft.office.interop.word.dll , access outlook inspector's wordeditor during inspector.activate event. once have access word.document - it's trivial load bookmarks , access/modify values.

outlook.inspector inspector = globals.thisaddin.application.activeinspector(); ((outlook.inspectorevents_10_event)inspector).activate += () => {   // validation ensure using word editor     if (inspector.editortype == outlook.oleditortype.oleditorword && inspector.iswordmail())     {         word.document worddoc = inspector.wordeditor word.document;         if (worddoc != null)         {             var bookmarks = worddoc.bookmarks;             foreach (word.bookmark item in bookmarks)             {                 string name = item.name; // bookmark name                 word.range bookmarkrange = item.range; // bookmark range                 string bookmarktext = bookmarkrange.text; // bookmark text                 item.select(); // triggers bookmark selection             }         }     } }; 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -