Solved

Read a signature.htm file with vb.net 2010

Posted on 2013-06-12
3
504 Views
Last Modified: 2013-06-13
I've never attempted this before,  any ideas on how to read the signature file from outlook using vb.net 2010. I'm wanting to read the individual line of the signature and edit them.

Any help would be greatly appreciated!

Thanks in advance.

Jim
0
Comment
Question by:transstates
  • 2
3 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
ID: 39242249
It's simply a text file (HTML) so you can open it up with a StreamReader and read it.

e.g.

Module Module1

    Sub Main()
        Using reader As New IO.StreamReader("C:\Users\kenneth\AppData\Roaming\Microsoft\Signatures\Internal.htm")
            Dim signature As String = reader.ReadToEnd()

            Console.WriteLine(signature)
        End Using
    End Sub

End Module

Open in new window


The filename will vary by how you named the signature in Outlook. Also, the path may vary based on your environment. You can adjust it according to the information here (Signatures section):

0
 

Author Comment

by:transstates
ID: 39242447
I want to be able to edit the signature if possible.  Is there a way to just read the actual signature lines and not all the others?
0
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 39242635
You'd need to parse the HTML. HTML Agility Pack would be good for this.

e.g.

Imports HtmlAgilityPack

Module Module1

    Sub Main()
        Dim htmlDoc As New HtmlDocument()

        htmlDoc.Load("C:\Users\kenneth\AppData\Roaming\Microsoft\Signatures\Internal.htm")

        For Each sigBlock As HtmlTextNode In htmlDoc.DocumentNode.SelectNodes("/html/body//p//span/text()")
            sigBlock.Text = "My new value"
        Next

        htmlDoc.Save("test.htm")

    End Sub

End Module

Open in new window


You might need to adjust the above, depending on how intricate your signatures are.

You can install HTML Agility Pack easily through NuGet, or you can download it from the link above.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now