Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Read a signature.htm file with vb.net 2010

Posted on 2013-06-12
3
Medium Priority
?
595 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

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 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

610 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