Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Add-Ins / May 2008

Tip: Looking for answers? Try searching our database.

Set Default Signature in Outlook 2007

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JK - 09 May 2008 21:02 GMT
Hi
I try to set default signature through code (C# & VS 2008), it successfully
writes 'New Signature' and 'Reply/Forward Signature' values in a registry.
When I open New mail or reply to any email, my signature does not appear.
I have to restart outlook everytime after setting Default Signature.
Is there any way that I can see my signature in New Email without restarting
the outlook?
Please help me out!!
JK
Ken Slovak - [MVP - Outlook] - 09 May 2008 21:50 GMT
I believe that should be "Reply-Forward Signature", not "Reply/Forward
Signature".

You wrote those values in Unicode to the REG_BINARY values to the correct
places in the profile registry keys?

Do the signatures work the next time Outlook is started and after that or
are you saying that the values are being changed after you set them?

Outlook only reads those values as far as I know when it starts up.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

> Hi
> I try to set default signature through code (C# & VS 2008), it
[quoted text clipped - 7 lines]
> Please help me out!!
> JK
JK - 09 May 2008 22:05 GMT
Thanks for your reply Ken.
You are right, it should be 'Reply-Forward Signature'. I just misspelled it
in the post.
When I set values for the registry in my code, it changes in the registry..
but the problem is that Outlook reads the values from the registry only on
startup.
I restarted the Outlook thru code..it worked fine but its annoying for the
user.
I dont want to restart Outlook.

> I believe that should be "Reply-Forward Signature", not "Reply/Forward
> Signature".
[quoted text clipped - 18 lines]
> > Please help me out!!
> > JK
Ken Slovak - [MVP - Outlook] - 12 May 2008 13:59 GMT
You are out of luck. Outlook will only read those values from the registry
when it starts up. Why not just write the registry values you want during
installation of your code? That way Outlook has the values when it starts
up.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

> Thanks for your reply Ken.
> You are right, it should be 'Reply-Forward Signature'. I just misspelled
[quoted text clipped - 7 lines]
> user.
> I dont want to restart Outlook.
JK - 12 May 2008 14:47 GMT
When user set a signature to default, that time I have to write values to
registry..not during installation. I wonder how it happens when we set a
default signature from Outlook, you open new email..u find the signature.
Microsoft doing the same functionality itself but not letting people to do it
. :-)

> You are out of luck. Outlook will only read those values from the registry
> when it starts up. Why not just write the registry values you want during
[quoted text clipped - 12 lines]
> > user.
> > I dont want to restart Outlook.
Ken Slovak - [MVP - Outlook] - 12 May 2008 16:01 GMT
Outlook caches a lot of data that is read on startup and changed in the UI,
then it may or may not update the registry from the cached information then
or at shutdown. However it doesn't read back registry values after startup.
A lot of configuration information is like that.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

> When user set a signature to default, that time I have to write values to
> registry..not during installation. I wonder how it happens when we set a
> default signature from Outlook, you open new email..u find the signature.
> Microsoft doing the same functionality itself but not letting people to do
> it
> . :-)
JK - 12 May 2008 16:35 GMT
Thanks Ken. Shall I inform my management that Outlook has to be restarted
after setting Default Signature? or I should look for some work around.

> Outlook caches a lot of data that is read on startup and changed in the UI,
> then it may or may not update the registry from the cached information then
[quoted text clipped - 7 lines]
> > it
> > . :-)
Ken Slovak - [MVP - Outlook] - 12 May 2008 18:39 GMT
You can look around, but I don't know of any workarounds.

Signature

Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm

> Thanks Ken. Shall I inform my management that Outlook has to be restarted
> after setting Default Signature? or I should look for some work around.
Sue Mosher [MVP-Outlook] - 12 May 2008 21:28 GMT
Here's a possible workaround, from LIsting 17.8 in my book. It probably works only if Word 2007 is installed, because it uses Word's Application.EmailOptions.EmailSignature.EmailSignatureEntries collection. Code is for VBA and gets information from the GAL to fill out the details of the signature. The juicy EmailSignatureEntries part is near the end.

Dim objOL                   ' As Outlook.Application
Dim objNS                   ' As Outlook.NameSpace
Dim blnWeStartedOutlook     ' As Boolean
Const olFolderInbox = 6
On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
   Set objOL = CreateObject("Outlook.Application")
   Set objNS = objOL.GetNamespace("MAPI")
   objNS.Logon "", "", True, True
   ' objNS.Logon "Outlook Settings", "", False, True
   blnWeStartedOutlook = True
Else
   Set objNS = objOL.GetNamespace("MAPI")
   objNS.Logon "", "", False, False
End If
If Not objNS.GetDefaultFolder(olFolderInbox) Is Nothing Then
   Call CreateSignature(objNS)
Else
   MsgBox "Could not start Outlook to set up signature"
End If
If blnWeStartedOutlook Then
   objNS.Logoff
   objOL.Quit
End If
Set objOL = Nothing
Set objNS = Nothing

Sub CreateSignature(objNS)
   Dim objMsg              ' As Outlook.MailItem
   Dim objDoc              ' As Word.Document
   Dim objSel              ' As Word.Selection
   Dim objSig              ' As Word.EmailSignature
   Dim colSig              ' As Word.EmailSignatureEntries
   Dim objExUser           ' As Outlook.ExchangeUser
   Dim objUser             ' As Outlook.AddressEntry
   Dim strSig              ' As String
   Dim objInsp             ' As Outlook.Inspector
   Const olmailitem = 0
   Const wdCollapseEnd = 0
   Const wdStory = 6
   Const olDiscard = 1
   Const olMinimized = 1
   Set objUser = objNS.CurrentUser.AddressEntry
   Set objMsg = objNS.Application.CreateItem(olmailitem)
   objMsg.Display
   Set objInsp = objMsg.GetInspector
   objInsp.WindowState = olMinimized
   Set objDoc = objInsp.WordEditor
   Set objSel = objDoc.Application.Selection
   With objSel
       .Move wdStory, -1
       .InsertAfter "--" & vbCrLf & Space(3)
       .Collapse wdCollapseEnd
       .InsertAfter objUser.Name
       .Font.Bold = True
       .InsertAfter "  "
       .Collapse wdCollapseEnd
   End With
   If objUser.AddressEntryUserType = _
     olExchangeUserAddressEntry Then
       Set objExUser = objUser.GetExchangeUser
       If objExUser.Department <> "" Then
           strSig = vbCrLf & Space(3) & objExUser.Department
       End If
       If objExUser.CompanyName <> "" Then
           strSig = strSig & vbCrLf & Space(3) & _
                    objExUser.CompanyName
       End If
       If objExUser.BusinessTelephoneNumber <> "" Then
           strSig = strSig & vbCrLf & Space(3) & _
                    objExUser.BusinessTelephoneNumber
       End If
       With objSel
           .InsertAfter objExUser.PrimarySmtpAddress
           .Font.Bold = False
           objDoc.Hyperlinks.Add objSel.Range, _
             "mailto:" & objExUser.PrimarySmtpAddress
           .Collapse wdCollapseEnd
           .InsertAfter strSig
       End With
   Else
       With objSel
           .InsertAfter objUser.Address
           .Font.Bold = False
           objDoc.Hyperlinks.Add objSel.Range, _
                                 "mailto:" & objUser.Address
           .Collapse wdCollapseEnd
       End With
   End If
   objSel.InsertAfter vbCrLf
   objSel.MoveStart wdStory, -1
   objSel.Font.Color = wdColorBlack
   Set objSig = _
     objDoc.Application.EmailOptions.EmailSignature
   Set colSig = objSig.EmailSignatureEntries
   colSig.Add objUser.Name, objSel.Range
   objSig.NewMessageSignature = objUser.Name
   objSig.ReplyMessageSignature = objUser.Name
   objInsp.Close olDiscard
   Set objMsg = Nothing
   Set objDoc = Nothing
   Set objSel = Nothing
   Set objSig = Nothing
   Set colSig = Nothing
   Set objExUser = Nothing
   Set objUser = Nothing
   Set objInsp = nothing
End Sub

Signature

Sue Mosher, Outlook MVP
  Author of Microsoft Outlook 2007 Programming:
    Jumpstart for Power Users and Administrators
   http://www.outlookcode.com/article.aspx?id=54

> You can look around, but I don't know of any workarounds.
>
>> Thanks Ken. Shall I inform my management that Outlook has to be restarted
>> after setting Default Signature? or I should look for some work around.
JK - 14 May 2008 14:25 GMT
thank you very much Sue. It worked for me :-)

> Here's a possible workaround, from LIsting 17.8 in my book. It probably works only if Word 2007 is installed, because it uses Word's Application.EmailOptions.EmailSignature.EmailSignatureEntries collection. Code is for VBA and gets information from the GAL to fill out the details of the signature. The juicy EmailSignatureEntries part is near the end.
>
[quoted text clipped - 112 lines]
> >> Thanks Ken. Shall I inform my management that Outlook has to be restarted
> >> after setting Default Signature? or I should look for some work around.

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.