SYSHALL
asked on
Outlook namespace Archiving
Hi I have a problem with autonaming Archivenames within Ouotlook GUI
I have as follow a vbscript that copy template.pst file to a specific folder with the date set of creation
for example:
c:\script\template.pst is copied to a folder and renamed to c:\scripts\backup\Archive\ 20081024ar chive.pst
( i will later redirect this to the users homefolder, but for now when testing i use this path)
I also have code that automounts this file in Outlook, but i dont know how i rename this namespace in outlook. As it is
now it gets the default name from the template. which means that i get several pst files kalled archive within outlook.
I would like to have them called 20090519archive, (by date of creation).
Anyone know how to accomplish this?Below is the vbscript i use, and it works except that the last thing i need is the autonaming in outlook!
Function padDate(intNumber)
if intNumber <= 9 Then
padDate = "0" & CStr(intNumber)
Else
padDate = CStr(intNumber)
End If
End Function
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
strDate = Year(Date) & padDate(Month(Date)) & padDate(Day(Date))
objFSO.CopyFile "C:\scripts\template.pst" , "c:\scripts\backup\" & strdate & "archive.pst" (this line creates the file 20090519archive.pst)
objFSO.CopyFile "C:\scripts\backup\" & strdate & "archive.pst" , "C:\scripts\archive\" & strdate & "archive.pst" (this line copies the 20090519archive.pst to alternate location)
Dim objApp
Dim objNameSpace
Set objApp = CreateObject("Outlook.Appl ication")
Set objNameSpace = objApp.GetNameSpace("MAPI" )
objNameSPace.AddStore "C:\scripts\archive\" & strdate & "archive.pst"
Thanks for any help with this!
I have as follow a vbscript that copy template.pst file to a specific folder with the date set of creation
for example:
c:\script\template.pst is copied to a folder and renamed to c:\scripts\backup\Archive\
( i will later redirect this to the users homefolder, but for now when testing i use this path)
I also have code that automounts this file in Outlook, but i dont know how i rename this namespace in outlook. As it is
now it gets the default name from the template. which means that i get several pst files kalled archive within outlook.
I would like to have them called 20090519archive, (by date of creation).
Anyone know how to accomplish this?Below is the vbscript i use, and it works except that the last thing i need is the autonaming in outlook!
Function padDate(intNumber)
if intNumber <= 9 Then
padDate = "0" & CStr(intNumber)
Else
padDate = CStr(intNumber)
End If
End Function
Set objFSO = CreateObject("Scripting.Fi
strDate = Year(Date) & padDate(Month(Date)) & padDate(Day(Date))
objFSO.CopyFile "C:\scripts\template.pst" , "c:\scripts\backup\" & strdate & "archive.pst" (this line creates the file 20090519archive.pst)
objFSO.CopyFile "C:\scripts\backup\" & strdate & "archive.pst" , "C:\scripts\archive\" & strdate & "archive.pst" (this line copies the 20090519archive.pst to alternate location)
Dim objApp
Dim objNameSpace
Set objApp = CreateObject("Outlook.Appl
Set objNameSpace = objApp.GetNameSpace("MAPI"
objNameSPace.AddStore "C:\scripts\archive\" & strdate & "archive.pst"
Thanks for any help with this!
ASKER
Hi and thank you for the answer, it partially work now, or at least i could get it to map the archive to outlook with a given name, i only had to use the two last lines of your code, at the end of the script, the final thing to solve now is to set the current date as the pst file uses as filename i have tried putting &strdate& in between the brackets off the friendly name in the last line but i only get an error, any solution to that?
Function padDate(intNumber)
if intNumber <= 9 Then
padDate = "0" & CStr(intNumber)
Else
padDate = CStr(intNumber)
End If
End Function
Set objFSO = CreateObject("Scripting.Fi leSystemOb ject")
strDate = Year(Date) & padDate(Month(Date)) & padDate(Day(Date))
objFSO.CopyFile "C:\scripts\mall.pst" , "c:\scripts\backup\" & strdate & "archive.pst"
objFSO.CopyFile "C:\scripts\backup\" & strdate & "archive.pst" , "C:\scripts\archive\" & strdate & "archive.pst"
Dim objApp
Dim objNameSpace
Set objApp = CreateObject("Outlook.Appl ication")
Set objNameSpace = objApp.GetNameSpace("MAPI" )
objNameSPace.AddStore "C:\scripts\archive\" & strdate & "archive.pst"
Set objFolder = objNameSPace.Folders.GetLa stobjFolder.Name = " & strdate & "Archive"
Kind rgeards
Michael
Function padDate(intNumber)
if intNumber <= 9 Then
padDate = "0" & CStr(intNumber)
Else
padDate = CStr(intNumber)
End If
End Function
Set objFSO = CreateObject("Scripting.Fi
strDate = Year(Date) & padDate(Month(Date)) & padDate(Day(Date))
objFSO.CopyFile "C:\scripts\mall.pst" , "c:\scripts\backup\" & strdate & "archive.pst"
objFSO.CopyFile "C:\scripts\backup\" & strdate & "archive.pst" , "C:\scripts\archive\" & strdate & "archive.pst"
Dim objApp
Dim objNameSpace
Set objApp = CreateObject("Outlook.Appl
Set objNameSpace = objApp.GetNameSpace("MAPI"
objNameSPace.AddStore "C:\scripts\archive\" & strdate & "archive.pst"
Set objFolder = objNameSPace.Folders.GetLa
Kind rgeards
Michael
ASKER
Hi again
Solved it partially
if i type
objFolder.Name = "" & strdate & "Archive"
I get the name of the object in outlook with current date but the name Archive is not included at the end
I only get 20090617 not 20090617 Archive as i would like to
Kind regards
Solved it partially
if i type
objFolder.Name = "" & strdate & "Archive"
I get the name of the object in outlook with current date but the name Archive is not included at the end
I only get 20090617 not 20090617 Archive as i would like to
Kind regards
Syntax error so replace:
objFolder.Name = " & strdate & "Archive"
with
objFolder.Name = strdate & "Archive"
Chris
objFolder.Name = " & strdate & "Archive"
with
objFolder.Name = strdate & "Archive"
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Chris
I get some strange results i get the date and the delimiter but not the rest
for ex: if i use strdate & " - Archive" i get only the date
but if i use strdate & "- Archive" i get the date and the delimiter but not the name archive
(notice the missing space infront of delimiter, thats the only difference between those two options)
i have tried other options as well, bute ither only get the date or the first letter or similar
Btw, Thanks a lot for your previous help,much appreciated!
I get some strange results i get the date and the delimiter but not the rest
for ex: if i use strdate & " - Archive" i get only the date
but if i use strdate & "- Archive" i get the date and the delimiter but not the name archive
(notice the missing space infront of delimiter, thats the only difference between those two options)
i have tried other options as well, bute ither only get the date or the first letter or similar
Btw, Thanks a lot for your previous help,much appreciated!
Spaces and hyphens should be valid chars for folders so I assume the same for the PST names all I can suggest is try a few permutations with and without spaces or space without the hyphen.
Chris
Chris
dim objFolder as object
objNameSPace.AddStore "C:\scripts\archive\" & strdate & "archive.pst"
Set objFolder = objNameSPace.Folders.GetLa
objFolder.Name = "Friendly Name"
Chris