![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
All,
I have managed to use a vbscript to create a new folder in all user Outlook, I need to go one step further and set the hompepage to a spesific URL we have 2000 users so going around to the desktops do not appeal ![]() Below is an overview of the script being used and the folder creation function ' OVERVIEW ' This script has been designed to enumerate users only in a specific OU (OU is determined by user input when executing the script) once complete, AD is queried for the users mailbox. ' Following the above, users and their mailbox id are used to call a function, during the function ' the users mailbox is accessed to check for folder names that exists in the root of their mailbox, ' all folder names are output, per user, to a text file (location determined by user input). If the ' referenced folder name does not exists it is created, followed by a cross check to confirm it has ' been created correctly. 'Folder Creation Function ' ********************** Function CreateMailFolder(aMailhome, sLogon, sFoldername, sFileLocation) dim application, cdosession dim strProfileInfo dim objFolder, folder Dim cdoInfoStore, cdofolderstore, objsession, objFolders, FindFolder, ObjStore, aNames, readtext, text, f, fso, of set cdosession = createobject("mapi.session") strProfileInfo = aMailhome & vbLf & sLogon cdosession.Logon "", "", False, True, 0, False, strProfileInfo If Err.Number = 0 Then ' wscript.echo Err.Number End If Set objFolder = cdosession.Inbox Set objstore = cdosession.Getinfostore(CDOsession.Inbox.storeid) If objFolder Is Nothing Then wscript.echo "Failed to open Inbox" End If const ForReading = 1, ForWriting = 2, ForAppending = 8 Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(sFileLocation) Then Else Set objFolder = fso.CreateFolder(sFileLocation) End If Set f = fso.OpenTextFile(sFileLocation & "\" & sLogon & ".txt", ForWriting, True) Set of = fso.OpenTextFile(sFileLocation & "\" & sLogon & ".txt", ForReading, True) For Each objFolders In objstore.rootfolder.folders f.writeline objFolders.name Next f.writeline "****First Read Complete***" f.writeline "" readtext = of.ReadAll text = "_Message Centre" If InStr (readtext, text) Then wscript.echo "Folder Already Exists for - " & sLogon else set folder = objstore.RootFolder.Folders.Add(sFoldername ,6) wscript.echo "Folder will be created for - " & sLogon oErr = 22 CreateMailFolder = err.number End If If oErr = 22 Then For Each objFolders In objstore.rootfolder.folders 'wscript.echo objfolders.name f.writeline objFolders.name Next readtext = of.ReadAll If InStr (readtext, text) Then wscript.echo "Folder has been successfully created for " & sLogon else wscript.echo "Folder was not successfully created for - " & sLogon CreateMailFolder = err.number End If End If Set fso = Nothing Set f = Nothing Set readtext = Nothing Set text = Nothing Set of = Nothing End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Set Outlook Hompepage for New Folder in Inbox | Ett | Outlook - General Queries | 1 | June 14th 06 02:48 PM |
Homepage | Jonathan | Outlook - Installation | 1 | April 26th 06 02:38 PM |
How should I set up folder structure in Outlook 2002? | Peter Barrett | Outlook - Installation | 3 | April 7th 06 12:27 PM |
.NET AddIn Question UserControl in Folder homepage | David Ing | Outlook and VBA | 8 | March 4th 06 12:24 PM |
set the defult folder for new contacts | Don Ashlock | Outlook - Using Contacts | 1 | January 24th 06 03:07 PM |