Aktīvā direktorija un Outlook Signature izplatīšana

Ko darīt, ja ir vajadzība lietojot aktīvo direktoriju uzņēmumā izplatīt parakstu atbilstoši darbinieka informācijai no AD. Ir risinājums! Šo izveidoojam ka VB skriptu un izplatām pie login.

On Error Resume Next

Set objSysInfo = CreateObject(“ADSystemInfo”)
strUser = objSysInfo.UserName
Set objUser = GetObject(“LDAP://” & strUser)

strName = objUser.FullName
strTitle = objUser.Title
‘strDepartment = objUser.Department
‘strCompany = objUser.Company
‘strPhone = objUser.telephoneNumber

Set objWord = CreateObject(“Word.Application”)
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.Style = “No Spacing”
Set objEmailOptions = objWord.EmailOptions
Set objSignatureObject = objEmailOptions.EmailSignature
Set objSignatureEntries = objSignatureObject.EmailSignatureEntries

‘Name of Staff
objSelection.Font.Name = “Calibri”
objSelection.Font.Bold = True
objSelection.Font.Size = “12″
objSelection.Font.Color = RGB(15,36,62)
objSelection.TypeText strName
objSelection.TypeText(Chr(11))

‘Role of Staff
objSelection.Font.Name = “Calibri”
objSelection.Font.Bold = False
objSelection.Font.Size = “11″
objSelection.Font.Color = 0
objSelection.TypeText strTitle
objSelection.TypeText(Chr(11))

‘Company Logo (stored in network share accessed by everyone)
objSelection.InlineShapes.AddPicture(“\\servername\netlogon\signature.jpg”)
objSelection.TypeParagraph()

‘Company Contact details
objSelection.Font.Color = RGB(38,38,38)
objSelection.TypeText “Tel +44 (0) 744 525 5214″
objSelection.TypeText(Chr(11))
objSelection.TypeText “Fax +44 (0) 744 524 2244″
objSelection.TypeText(Chr(11))
objSelection.Font.Color = RGB(23,54,93)
objLink = objSelection.Hyperlinks.Add(objSelection.Range,“http://www.sujeeth.net/”,,“Sujeeth Home Page”,“www.sujeeth.net”)
objSelection.TypeParagraph()
objSelection.TypeParagraph()

‘environment message
objSelection.Font.Name = “Webdings”
objSelection.Font.Size = “14″
objSelection.Font.Color = RGB(115,155,63)
objSelection.TypeText “P “
objSelection.Font.Name = “Calibri”
objSelection.Font.Size = “9″
objSelection.TypeText “Please consider the environment before printing this e-mail.”

Set objSelection = objDoc.Range()

objSignatureEntries.Add “Standard Signature”, objSelection
objSignatureObject.NewMessageSignature = “Standard Signature”
objSignatureObject.ReplyMessageSignature = “Standard Signature”

objDoc.Saved = True
objWord.Quit

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s