Solved

Export mail items from Public Folders in outlook

Posted on 2012-04-11
109
839 Views
Last Modified: 2012-05-18
Dear experts,

we have a superb code from EE_Chris to export mail items from outlook folders with their folder structure. It works great, but it doesn't work for Public Folders.

We want to achieve exactly same for Public Folders in outlook. PF data is around 80GB. Exmerge or pst is not an option.

Is there any possibility to adapt attached script to our need please?

K rgs
PFolders.png
script.txt
0
Comment
Question by:DigitBoy
  • 62
  • 45
  • +1
109 Comments
 
LVL 1

Expert Comment

by:Xvand
ID: 37833092
the way we do it is in outlook
export public folders as pst. make sure you have full rights to all public folders
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37833325
I don't have a way of testing this at the moment, so I'm going from memory, but try replacing:

    Set fldr = olkApp.Session.getdefaultfolder(6)
    Q_26908386_recur fldr, strRootDir & "\" & FileNameCharsOnly(fldr.name)

with

  for each store in olkApp.Session.stores
    set fldr = store.getrootfolder
    Q_26908386_recur fldr, strRootDir & "\" & FileNameCharsOnly(fldr.name)
  next
0
 
LVL 17

Expert Comment

by:WORKS2011
ID: 37833364
check / edit the permissions on the public folders using the PFAdmin tool then run the script again.  you can download it here

I believe by the screenshot you're using Exchange 2007 or earlier, correct?
0
 

Author Comment

by:DigitBoy
ID: 37833933
Hi ,

yes it is an Exchange 2003. We checked already permissions and our service accounts have full permissions. The permissions is not the problem in this case.

As we said it is not recommended to export 80GB to multiple pst files. PST is not enough stable to keep for years. In the past and still now we have a lot of issues.

@LeeDerbyshire,

Thanks for your code. I will modify it and will come back with feed back to you.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37833957
Hi LeeDerbyshire,

it doesn't work.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37834168
Were there any error messages?
0
 

Author Comment

by:DigitBoy
ID: 37836399
No errors. with the original script there were no errors either.
0
 

Author Comment

by:DigitBoy
ID: 37836436
For all other folders like pst it works very good, but for PF it does nothing at all. No errors and no trace of exported items.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37837306
Okay, I'll try to get something working here.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37837467
There are a few lines to remove:

The line that says WScript.Echo shortDOSFolderpath (unless you want to keep clicking the popup messages)

The line that says If fldr.DefaultItemType = 0 Then (and the matching End if)

The line that says If mai.Class = 43 Then (and the matching End If)

These last two lines make it ignore folders that don't contain ordinary messages (which your Public Folders probably don't).

You also need Outlook running, and you need to accept the prompt to allow it to access your mailbox (try selecting 10 minutes - this script takes a long time to run).  Mine hasn't reached the Public Folders yet, but I thought I should mention what I've found so far.
0
 

Author Comment

by:DigitBoy
ID: 37837708
HI LeeDerbyshire,

are you sure that they can be removed. I'm just asking you because I'm don't have experience in programming. I hope only those lines will not break to read long folder path names in outlook.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37838232
I have attached a modified version of the script if you want to try it?  Won't change anything in Outlook.
Script.txt
0
 

Author Comment

by:DigitBoy
ID: 37841358
Hi LeeDerbyshire,

during the executing the script. I got following error message:

line: 122
Char: 5
Error: Path not Found
Code: 800A004C

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37842064
Yes, I get that too, if a folder name has complex characters in it (Chinese, Hebrew, etc.).  Do you have any such folder names?  I'm not sure what to do about that yet - I'll take another look at the script, but I'm not 100% sure what all of it is doing.  It's not always easy to follow someone else's code.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37842330
Okay, I now have something that will work with all my strange folder names.  Please try the attached new version.
Script.txt
0
 

Author Comment

by:DigitBoy
ID: 37843078
Hi LeeDerbyshire,

the orginal code was ment to export mail items and their folder structures with more then 256 characters and it works great. Only problem with the orginal script was to export PF :(.

exp outlook long folder names:
  - inbox
    - subfolderxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
          - subsubfolderrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
               - subsubsubfolderpppppppppppppppppppppppp
                   - subsubsubsubfoldertyyyyyyyyyyyyuuuuuuuuuuuuuuuuuu
                     -subsubsubsubsubmmmmmmmmmmmmmmmmmmmmmm
                           etc...

I will try your script will come back with feed back.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37843092
same error message:

Line 111
Char 5
Error Path not found
Code 800A004C
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37844078
Okay, I'll take another look.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37846109
Okay, I have reduced the script to the bare essentials.  We can start from here if there are any problems.  New script is attached.
script-3.txt
0
 

Author Comment

by:DigitBoy
ID: 37846375
Hi LeeDerbyshire,

the script does nothing at all. No error message, nothing exported.



K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37846845
Okay.  This one should display the message 'Starting...'  in a popup box when you double click it (just to make sure that it is actually executing).  Then it should show the name of each information store that it is working on.  First should be the Mailbox, then (after a very long time), the Public Folders.
script-4.vbs
0
 

Author Comment

by:DigitBoy
ID: 37847433
Hi LeeDerbyshire,

sorry to say, but after waiting more than 4O min nothing happened, not even a message with "starting...".

It does nothing at all and also there is no error message :(.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37847480
Hi LeeDerbyshire,

My mistake accidently I did something. The script is running now and will come back to you with feed back.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37848761
Hi LeeDerbyshire,

I got an error message, because of the long folder names. (in the image you will see a silly example of our many subfolders with long names in our outlook and PF)

line 25
char 43
error File not found
code 800A0035

K rgs
Folder-Structure.png
0
 

Author Comment

by:DigitBoy
ID: 37848920
Hi LeeDerbyshire,

as you said after picking up every mailbox and pst folders with their mail items it started to export folders in PF, but as before mentioned I got an error message due to very long characters (more than 256)  and special characters (non supported by DOS). There are many subfolders (see image posted before).

Is there now a way just select a folder in stead of everything please?

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37849438
Are the special characters not supported by Windows, though?  Can you give an example (even just a few random characters), so that I can do some testing here?  When I tried it here, it did manage to create Windows folders with Cyrillic and Hebrew characters.  But, of course, I know that there are many other character sets that might cause problems.  When I solve that problem, I'll move on to selecting a single folder.
0
 

Author Comment

by:DigitBoy
ID: 37850142
Hi LeeDerbyshire,

In the previous code there was something like regex "[^A-Za-z0-9$ %'\-_@~`\(\)\+\\,;=\[\]§-ÿ]" to replace some characters with another. One o fthe Example of character was "\" (backslash).

I wanna thank you for all the energy to you're putting in the coding.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37850243
The regex bit didn't seem to work here, so I did it manually for now.  I'll have another look at it later.  I have some folders here that have names completely made of complex characters (for testing purposes), and some of them seemed to upset the regex code.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37850979
Okay, I put the regex back in (with the same expression).  But now, no complex characters survive at all.  Also, when I put it back, I was getting the 'File not found' error again.  Probably because some of my test folders names are made entirely of complex characters, and the regex replaced every one with a space.  I changed it to use underscore instead, because windows won't create a folder if the name is all spaces.  I also added a single line to replace the backslash with an underscore (the regex as it stands allows backslash to get through), because you obviously can't have a backslash in a folder name.  I could have removed \\ from the regex, but I want to leave it as it is for now, in case I misunderstood what it was doing.

Also, this version of the script creates empty text files, instead of actual saved messages, because then it doesn't take so long to test.  It's an easy change to make it save messages again.
script-5.vbs
0
 

Author Comment

by:DigitBoy
ID: 37851037
Hi LeeDerbyshire,

thanks for the code I will test it right now and will come back to you.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37851083
Hi LeeDerbyshire,

Wow I have to say it is much faster then before :).
For the non supported characters as you said, they were replaced by "_" :) really supperb.

Only I got again same error message for very long characters due to folder and many subfolder names  (see previous image).


error message:
Line 40
Char 5
Error Path not found
code 800A004C


K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37851411
It'll be slower when we change it to actually save messages, rather than creating empty files :)

How do you want to handle this long folder path problem?  We have to make the names shorter somehow, which is easy enough, but if we overdo it, then the names won't make much sense, and there's more chance of duplicating them.  What's the maximum folder depth it will be expected to work with?  Windows has a maximum path length of 260 characters (I think), so if your folders are nested to (say) 10 levels, then we'd be looking at limiting folder names to about 24 characters (we'd still have to add the length of the file name to that).
0
 

Author Comment

by:DigitBoy
ID: 37851459
Hi LeeDerbyshire,

the orginal script in my question works great for the long folder names, I've tested several times with success even with 10 long sub folder names. Sorry for asking, but is it posisble for you to look in the code that I've posted, because that one works.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37851521
Hmm.  I did, at first, but I got that file not found error.  Actually, I think it shortened the folder names anyway.  But I'll take another look.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37851691
Okay, it works better than before, because I've learned a few things since I first looked at it:
1.  Take \\ out of the regex string (so that it won't allow backslash in filenames).
2.  Use underscore instead of space when replacing characters (so that you never end up with an empty name).

This version will still only save empty text files for speed of testing.

I commented out the lines

If fldr.DefaultItemType = 0 Then

and

If mai.Class = 43 Then

because with them in the code it will probably ignore your public folders (I don't know what message class you configured them to create), but it also means that you get everything else that isn't a message, too.

I added a msg box so that it will let you know when it starts to work on the public folders.  Apart from that, everything else is the same.
script-6.vbs
0
 

Author Comment

by:DigitBoy
ID: 37851740
Hi LeeDerbyshire,

thanks again for the code. I will test it right away.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37851796
Hi LeeDerbyshire,

Really fantastic it works :D for very long folder names.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37851835
Okay, so next thing would be to get it to save real .msg files:
script-7.vbs
0
 

Author Comment

by:DigitBoy
ID: 37853330
Hi LeeDerbyshire,

export to msg worked also :D.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37853622
That's good news.  So, it looks like the first change I suggested would have worked, if it hadn't been for the regex having a \\ in the expression, and using spaces as a replacement.  But it's been interesting anyway.  The script seems able to create very long paths, that you can't usually do in something like explorer.  For instance, if you try to move one of the .msg files to a nearby folder, Explorer will refuse to do it.  I'll have to have a closer look, because something very interesting is going on.
0
 

Author Comment

by:DigitBoy
ID: 37854854
Hi LeeDerbyshire,

I've tested further and noticed that not all mail items or sub folders were exported during the test. The script didn't give any errors. Really strange. In some subfolders there are more than 3000-12000 mail items. I saw for folders with few 100 items, it exported fine.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37855472
If you move or copy one of the items that didn't get exported to a folder with fewer items in, does it get exported?

To speed up testing, look at these two lines:

mai.saveas strFileName, 3
'fso.CreateTextFile strFileName

The first line is one that saves the email, and the second creates an empty text file, but runs very much faster.  Note that the second one is commented out with an apostrophe.  If you change it like this:

'mai.saveas strFileName, 3
fso.CreateTextFile strFileName

so that the first line is commented out instead, then any testing can be done much quicker.
0
 

Author Comment

by:DigitBoy
ID: 37855510
Hi LeeDerbyshire,

I copied some mail itmes to a folder with fewer items and they were exported fine.


K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37855584
For the case where some, but not all, items in a folder are exported, how many items are successfully exported to disk (have a look in explorer, and see how many items are shown in the status bar)?
0
 

Author Comment

by:DigitBoy
ID: 37855731
Hi LeeDerbyshire,

for mail items around 50% and for folders/sub folder around 30% exported.
Maybe I found why, we have a lot of PF with exactly same names. I saw that the script exported only non duplicate folder names or mail items (I'm not 100% sure about this).

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37855912
I know that it tries to find a unique item names (there's a bit of code that adds numbers to the end of the file names), although that might not be working, of course.  I'll have a look.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37855967
Hm.  That bit does seem to work okay.  Duplicate subjects should look like this:

hello_.msg
hello_1.msg
hello_2.msg

etc.  Do you see anything like this for the msg files?  Outlook doesn't allow you to have duplicate folder names in the same location, so I don't think there's any code to handle this,  although after they have had complex characters changed to _ , then there may well be a conflict.  You may find that some folders have too many items in them.
0
 

Author Comment

by:DigitBoy
ID: 37856105
Hi LeeDerbyshire,

yes indeed I see those *_1, *_2 msg files. It is possible to do it same for Folders please?
If it finds a duplicate folders/sub folders then it adds some numbers as msg.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37856155
Do you really have duplicate folder names at the same location in Outlook (i.e. within the same parent folder)?  Or is it because it is changing complex characters to _ , and so you sometimes end up with a duplicate because of that?
0
 

Author Comment

by:DigitBoy
ID: 37856193
Hi LeeDerbyshire,

No we have really in PF a lot of duplicate folder names at same location.
exp:
   - parent folder
          - IT_1
          - IT_1
          - IT_1  
K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37856323
Do you know how they got created?  I'm unable to create such folders here.  Not in Outlook, or anything else I try.  The problem is, I can't test the code properly if I don't have duplicates like you do.
0
 

Author Comment

by:DigitBoy
ID: 37856408
Hi LeeDerbyshire,

these Pf folders are migrated from previous Linux servers 5 years ago. That's why we have such kind of folders :(.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37856438
Okay, I guess that could happen :)  Right now, the only thing I can think is to add an incrementing number to each folder, whether they're duplicated or not.  Try this one:
script-8.vbs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37856463
Oh, I changed the regex expression to see if it could work with complex folder names.  If you get an error in this latest one, remove the line that says
        .Pattern = "[\\/:*?""<>|\s]"
leaving the regex as it was before I changed it.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:DigitBoy
ID: 37856546
Hi LeeDerbyshire,

really thanks for the code. I've tested the new code and I got new error message:

line 17,5
runtime error: ActiveX component cannot create object "outlook.application".

I removed this ".Pattern = "[\\/:*?""<>|\s]" line, but I got same error message about ActiveX.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37856561
Hm, this is more serious - I haven't changed that part of the code at all.  It's nothing to do with the regex.  The ActiveX bit just starts up an outlook session in the background.  Are you trying this on the same computer as before?
0
 

Author Comment

by:DigitBoy
ID: 37856762
It is on the same machine
0
 

Author Comment

by:DigitBoy
ID: 37856806
Sorry My mistake. I'm so clumsy.
The script ran and it the result is same as before. No duplicate folders exported :(.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37856878
Do you see the _1 and _2 etc on every folder saved?
0
 

Author Comment

by:DigitBoy
ID: 37857076
Yes I can see them, but no duplicate folders.
0
 

Author Comment

by:DigitBoy
ID: 37858369
Hi LeeDerbyshire,

I verified again. I saw the _X numbers, but there are no similar folder names on same level with differnt numbers on the end.

exp:
  - Parent folder
       - Test_1
       - FI_1

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37860356
Okay, here's another one.  This just creates a list of all the folders in a file named c:\folderlist.txt .  We will be able to see if the for ... next loop is ignoring folders, or if it is failing to create the file.
script-9.vbs
0
 

Author Comment

by:DigitBoy
ID: 37862515
Hi LeeDerbyshire,

there is an erorr: ActiveX component can’t create object.
The exported file is empty :(.

k rgs
0
 

Author Comment

by:DigitBoy
ID: 37862724
sorry my mistake again :(. Be patient with me please. I'm real a zero regarding coding.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37863098
No problem.  You may be an expert by the time we've finished.  Anyway, let me know if any of the folders are missing from the file.
0
 

Author Comment

by:DigitBoy
ID: 37863117
Hi LeeDerbyshire,


sorry that it took so long.  I stopped in middle of export, because I saw that outlook was losing connection to th Exchange server due to many mappi sessions. I verified the exported folders and all the duplicate folders were exported really fantastic :D. I don't know how you did it, but I'm super excited.

Is there a way just select a folder to export please? This will take less time to export and so I can verify much thoroughly.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37863159
Hm, are you sure they're all there?  I haven't really changed anything significant, only added the text file containing the list of folders.  Which script number are you running script-9.vbs or script-8.vbs ?

The only way I can think of specifying a folder is to type a folder name somewhere in the script, and tell it to ignore everything else.  The problem there is that if you have duplicate folder names, you will probably end up with just the first, or all of them.  Or we can create another text file where we save the folder ids, and you can paste one of those in the script.  Which would you prefer?  The second is the only way of accurately specifying a folder, but it requires the intermediate step of getting the list of folder ids.
0
 

Author Comment

by:DigitBoy
ID: 37863252
Hi LeeDerbyshire,

I used script-9.vbs. At first sight it seems to be they are exported. Maybe (I'm saying something stupid) due to export of mail items it blocks somewhere.
To be sure if it is possibel for you, before chosing option 2, just pickup one folder and export folders & mail items using adapted script-9.vbs please?

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37865539
Hm, script-9 does not save any items - I commented out the parts that do the saving while we are troubleshooting.  It does create the empty folders, though.  If there are any items in them, they must have been there from before.

Anyway, to pick a single folder, we will need to know its EntryId.  Script-10 will create a list C:\FolderList.txt that contains folder names followed by their EntryIds.  If you can find the folder you want to use, let me know the EntryId, and I'll put it in the script as the folder to work with.
script-10.vbs
0
 

Author Comment

by:DigitBoy
ID: 37865568
Many thanks I will try out :).
0
 

Author Comment

by:DigitBoy
ID: 37867185
Hi LeeDerbyshire,

it took very long.

first parent folder id: 00000000F017G3BAKD12478cA9D757F1AD244BDN020000006030205902353661913735343038336800

Will this export also all other subfolders? Because our goal was to select only parent folder and to export all subfolder withe their itmes instead of all PF in one shot. We don't wont to export subfolders individually :(.

We have a lot of parent folders.
K rgs
0
 

Author Comment

by:DigitBoy
ID: 37867194
What I mean it took very long because amount of data in PF :( and not because of your script. sorry for mistunderstanding.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37867345
It's not really my script :-)

Anyway, I put your folder id in the latest script.  If you edit it in Notepad, you can get it to start with any folder.  It will also do any subfolders, although it would be easy to stop it doing subfolders.
script-11.vbs
0
 

Author Comment

by:DigitBoy
ID: 37867500
Hi LeeDerbyshire,,

Thanks again for your tremendous work. I will test right away.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37867690
Hi LeeDerbyshire,

I don't want to ask you in this same question, because I'm already asking you so much that's why I made another question with max points regarding how to select a folder (parent folder and its subfolders & PF) and to export their folder IDs to txt file.
 
http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/Q_27684050.html

Is it possible to look at this question please?


K rgs

PS: I'm still testing the script :).
0
 

Author Comment

by:DigitBoy
ID: 37868294
Hi LeeDerbyshire,

I'm still testing the script, but due to frequent outlook crash I have to start all over again and again. Is there a way to skip folders or items that are already exported?

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37869584
Hi LeeDerbyshire,

I don't know what is happening, it doesn't still export the duplicate names.

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37869657
I've tested again script-11 and changed the line below to test faster, but no duplicate folders exported.

'mai.saveas strFileName, 3
fso.CreateTextFile strFileName
0
 

Author Comment

by:DigitBoy
ID: 37870384
Hi LeeDerbyshire,

please forget other questions above. I have only one left. Is it possible to add a second iD instead 1?

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37870720
Hello again DigitBoy.  You say 'forget the other questions' - is it working properly now?  Should be easy enough to add a second ID, I'll send something later.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37870823
You should be able to enter your ids into an array using this script.  There are two of mine in there (for testing) so don't try to run it without putting your own in first.
script-12.vbs
0
 

Author Comment

by:DigitBoy
ID: 37870994
hi LeeDerbyshire,

thanks for your response no it has still some problems to export duplicate names.
I'm testing in different way. I will give asap feed back.


K rgs
0
 

Author Comment

by:DigitBoy
ID: 37871184
hi LeeDerbyshire,

the latest script is putting everything in same folder. (I used the EntryIds of 2 folders with exactly same duplicate names.)

It is so fustrating and so complicated to export the duplicates.

Is there a way to read a txt file with all EntryIDs inside and export them? Or is it easier to rename all folders with duplicated names and then to export?

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37871325
Hi LeeDerbyshire,

the behavior if you take EntryIDs is it will create only 1 folder for duplicate names. also tested with previous script.

 K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37871400
Yes, I forgot to add the incrementing number to folders handled by the first loop.
script-13.vbs
0
 

Author Comment

by:DigitBoy
ID: 37871525
Hi LeeDerbyshire,

good news :D, it exported the 2 duplicates in seperated folders. I want to export more folders, is it possible to read the EntryIds from txt file, it is easier to handle for people like me with coding handicap please?

K rgs
0
 
LVL 31

Accepted Solution

by:
LeeDerbyshire earned 500 total points
ID: 37871584
If you create a file named EntryIds.txt in the same folder as the script, and put one on each line, this should work.
script-14.vbs
0
 

Author Comment

by:DigitBoy
ID: 37871751
it says error file not found line 30. The entryids file is there in same folder as the script and same name as you mentioned.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37871811
I'm sure it should be okay if the script and the txt file are in the same folder.  But try putting the full path in the script, instead of just EntryIds.txt

  Set f2 = fso.OpenTextFile("C:\Foldername\whatever\EntryIds.txt")
0
 

Author Comment

by:DigitBoy
ID: 37871921
this works to find file Set f2 = fso.OpenTextFile("C:\Foldername\whatever\EntryIds.txt") thank you :).
0
 

Author Comment

by:DigitBoy
ID: 37872073
It creates fine the duplicate folder names, but msg files are multiplied by 2 every time and that was not before.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37872585
Are you sure you deleted what was already there before you tried it most recently?  If you run the script when the messages have already been exported, it will duplicate the messages (with _1 _2 etc. on the end) in the way you describe.
0
 

Author Comment

by:DigitBoy
ID: 37872752
I think you are right. I feel so stupid :(.
I'm going to test further :).
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37872998
No need to feel stupid, it's easy to forget something like that.  It would be nice if we could just overwrite what is there each time you run it, but then it would be hard to find a way to handle messages that have the same subject.
0
 

Author Comment

by:DigitBoy
ID: 37891580
Hi LeeDerbyshire,

Sorry That it took several days to respond you, I'm still testing and adapting some things (not your script). If it is alright for you I will come back next Monday with final status. My apologize therefore.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37891816
No problem, I'm not in any hurry.
0
 

Author Comment

by:DigitBoy
ID: 37921391
Hi LeeDerbyshire,

sorry for waiting. I'm back with news. Your script works really great. It is pity that I cannot give you more points then the maximum.

You helpded me a lot. Really fantastic support.
Again thank thank your so much.

K rgs
0
 

Author Closing Comment

by:DigitBoy
ID: 37921409
A guru and one of a kind about coding skills with fantastic support. It was a pleasure to have someone like LeeDerbyshire as mentor during the support.
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37921490
Thanks for the kind words - and I learned a few things, too.  Stick something on the end of this thread if you need something else (I don't often get time to check the new EE threads).  But since I'm on vacation for the next couple of weeks, you may have to wait :-)
0
 

Author Comment

by:DigitBoy
ID: 37962848
hi LeeDerbyshire,

sorry for disturbing you again, but I had some issues again.
The script stops during export of mail itmes if there are more then 1000 items. it exports only 60 of 2000 items. Is there any possibility to built in verification please? It counts mail items the of the right "entry ID" folder and if it doesn't find match with exported ones, it must re-export the missing ones. Is this possible please?

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37962858
Hi LeeDerbyshire,

I found the issue why it didn't export. In the subject there are "()", ";", "-", ":", "/", "\", "|" characters.

Can i modify the regex pattern and how please?

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37962869
Hi LeeDerbyshire,

please skip the last one with characters.
Is it still possible for you to look at the "ID: 37962848" please?

K rgs
0
 

Author Comment

by:DigitBoy
ID: 37962875
To be more specifit about the error:

Line: 62
Char 9
The operation failed

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37975084
Hi there.  Sorry for the delay - I've been away on vacation.  Are you still having a problem with the script?
0
 

Author Comment

by:DigitBoy
ID: 37984706
Hi LeeDerbyshire,

My deepest apologize to disturbing you again, especially after a nice vacation. Hopefully you enjoyed well :).

yes I am :(. It seems to be that the script cannot save certain messages for some reason (to be honest with you I don't why) and it stops.

Error message: Line 62, save items

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37984788
Okay, this one will continue to save items after an error (although it won't save the item that caused the error), but it will show an alert indicating the filename it tried to save when the error happened.  Perhaps there will be something strange in the filename.
script-16.vbs
0
 

Author Comment

by:DigitBoy
ID: 37985153
Hi LeeDerbyshire,

million thanks for the giving code.
Is there any possibility to write the warnings to a log file please? Because there are more then 1000 items :(.

K rgs
0
 
LVL 31

Expert Comment

by:LeeDerbyshire
ID: 37985272
Try this one
script-17.vbs
0
 

Author Comment

by:DigitBoy
ID: 37985331
Million thanks again :). I will try right away.
0

Featured Post

The problems with reply email signatures

Do you wish that you could place an email signature under a reply? Well, unfortunately, you can't. That great Exchange/Office 365 signature you've created will just appear at the bottom of an email chain. What a pain! Is there really no way to solve this? Well, there might be...

Join & Write a Comment

Sometimes Outlook might have problems sending a message. There may be various causes- corrupted PST, AV scanner etc. The message, instead of going to the Sent Items folder, sits in the Outbox indefinitely. To remove it you can use a free tool cal…
Find out how to use Active Directory data for email signature management in Microsoft Exchange and Office 365.
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now