Windows Scripting
  Home arrow Windows Scripting arrow Page 2 - Generating Outlook Signatures Based on Act...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Generating Outlook Signatures Based on Active Directory Information
By: Luke Niland
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2008-06-23

    Table of Contents:
  • Generating Outlook Signatures Based on Active Directory Information
  • Checking for Existing Signature File
  • Creating the signature
  • Finishing the Signature File

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Generating Outlook Signatures Based on Active Directory Information - Checking for Existing Signature File


    (Page 2 of 4 )

    Before we start to create anything, it's always a good idea to do a couple of checks first. First of all, let's make sure the signature directory exists before trying to create anything in it -- if it's not there, then create it:


    'check the existence of the sig dir, if not there create it

    if not FileSysObj.FolderExists(SigFolder) then

    FileSysObj.CreateFolder(SigFolder)

    end if


    These lines use the File system object we created at the start of the script to check for the existence of the signature folder. If that check returns false, then we create it using the file system object again.

    The next thing we are going to do is work out if we actually need to go through the process of creating the signature.

    We will do this by first checking for the existence of the signature file, then seeing if the last modified date of the file is before the last modified date of the user. If the user has changed since the file was created, we need to create the file again, otherwise we don't need to bother. The following section of code accomplishes this task:


    if FileSysObj.FileExists(SigFile) then

    'get amended date of file, then compare it to the changed date of the user

    Set objFile = FileSysObj.GetFile(SigFile)

    datSigAlt = objFile.DateLastModified

    intTimeDiff = DateDiff("n", datSigAlt, UserObj.whenChanged)

    'if the difference is less than 0 then we do not need to do anything as the sig file is uptodate

    if intTimeDiff < 0 then wscript.Quit

    end if


    Once we know if the signature file exists, we get a handle on it and find out the last time it was modified. Once we know this, we compare in minutes to the last time the user object in the active directory was modified. If the difference is less than zero (0), then the script must be up-to-date, so we don't need to do anything and can just quit the script.

    If we are still running at this point, it's time to create the signature file.

    Getting the information for the signature file

    Before going headlong into creating the file, it's a good idea to first know what you want in it. The example I am going to use will contain simple contact details (name, position, address, telephone, fax, email, and website), a company logo graphic, and a link to some terms and conditions. Your requirements, however, might be different. So how do you know what all the fields in the active directory user object are called?

    Well, there is a little app available from Microsoft, called ADSIEdit, that comes with the Windows 2003 support tools. Using this app, you can browse your domain, and see all the objects in it.

    If you right click on an object and view its properties, you can see a list of all the available attributes and their current values. You can pick up any of these attributes and insert them into your signature.

    More Windows Scripting Articles
    More By Luke Niland


       · Thanks for a useful article. I may implement this on a web page so that Users can...
       · The line:-SigFolder = StrAppData & "MicrosoftSignatures"should, of course,...
       · Hi - sorry this may seem obvious but I haven't used VB for years (C# used by last...
       · Hi Lucy,The example her is just a vb script, and as far as i'm aware you wont be...
       · Hi "I would make it automatically set the default Auto signature though."I...
     

    WINDOWS SCRIPTING ARTICLES

    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...
    - Modifying XML Files in WSH
    - Reading XML Files in WSH
    - Visual Basic 2005 XML Programming Using XML ...
    - Creating an XML Document in WSH
    - Introducing Two-Way Data Binding using Silve...
    - Silverlight 2.0 Application Development with...
    - Burning Multisession CDs with IMAPI2 in WSH
    - Creating a Silverlight 2.0 Application that ...
    - Burning CDs with the IMAPI2 Control
    - Burning CDs in Windows XP with WSH

     
    Best Practices for Windows Vista Migration Presentation
    Dell and Microsoft recently held a series of face-to-face seminars entitled, &qu....

     
    Creating a Culture for Code Reuse
    If you oversee development teams you know that like it or not proprietary and ex....

     
    Keys to Web Application Acceleration: Advances in Delivery Systems
    Accelerate Web apps by up to 5x. Ensure significantly faster access to the Web a....

     
    Optimizing Application Monitoring
    Tired of finding out from your customers that you're offline? This white paper e....

     
    Solaris to Solaris Migration -- Migrating applications from Sun SPARC to Dell PowerEdge R900
    This comprehensive Migration Guide reviews the approach that Principled Technolo....

     




    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
    Stay green...Green IT