J
jules
Hi.
I am a using Outlook 2000 on Windows XP and I am programming with VB6.
Currently I'm facing a strange problem with deleting a mapi folder
programmtically.
Situation: There are around 50 mapi folders (Fold01 - Folder48) that
have been created initially. Each of these folders does contain one!
subfolder. When Outlook starts, my COM-Adding should delete each
subfolder of each toplevel folder. This is done with
TopFolder.Subfolder.Delete. Subfolder of couse is of type MapiFolder.
This seems to work for the first 20 folders but when it comes to the
21st Outlook throws an error saying:
"Unable to delete this folder. Right-click the folder, and then click
Properties to check your permissions for the folder. See the folder
owner or your administrator to change your permissions."
According to this error message I've got some permission problem.
Unfortunately this not true because I did (more than once) randomize
the order in which each of the subfolders should be removed. Strangly
enough it is always the 21st folder that refuses to remove.
I did then try to remove these remaining folders manually. Same error
message here.
Here's a code snippet:
set WGFolders =
OutlooContext.MainFolder.AllWorkGroupFolder.WorkGroupFolders;
For i = 1 To WGFolders.Count
Set soWGFolder = WGFolders.Item(i)
If soWGFolder.WorkGroup.name = primaryWorkGroup Then
Set soWiFolder = soWGFolder
Call soWiFolder.SuspendFolder.Delete
'!!!!!!!!!!!!!!!!!!!!!!!!!!
End If
' .....
Next
Please keep in mind that this works with the first 20 MapiFolders and
the order does not seem to matter.
You see I'm using a up-counting loop but also tried with a for each
construct.
SuspendFolder is as I mentioned earlier the subfolder that should be
deleted and is of type MapiFolder!
Another strange thing is when I display that error message with
Err.Number I do always face a different error number.
Does anybody ever faced a similar problem?
Any suggestions, hints, tips,....?
Thanx in advance and best regards
I am a using Outlook 2000 on Windows XP and I am programming with VB6.
Currently I'm facing a strange problem with deleting a mapi folder
programmtically.
Situation: There are around 50 mapi folders (Fold01 - Folder48) that
have been created initially. Each of these folders does contain one!
subfolder. When Outlook starts, my COM-Adding should delete each
subfolder of each toplevel folder. This is done with
TopFolder.Subfolder.Delete. Subfolder of couse is of type MapiFolder.
This seems to work for the first 20 folders but when it comes to the
21st Outlook throws an error saying:
"Unable to delete this folder. Right-click the folder, and then click
Properties to check your permissions for the folder. See the folder
owner or your administrator to change your permissions."
According to this error message I've got some permission problem.
Unfortunately this not true because I did (more than once) randomize
the order in which each of the subfolders should be removed. Strangly
enough it is always the 21st folder that refuses to remove.
I did then try to remove these remaining folders manually. Same error
message here.
Here's a code snippet:
set WGFolders =
OutlooContext.MainFolder.AllWorkGroupFolder.WorkGroupFolders;
For i = 1 To WGFolders.Count
Set soWGFolder = WGFolders.Item(i)
If soWGFolder.WorkGroup.name = primaryWorkGroup Then
Set soWiFolder = soWGFolder
Call soWiFolder.SuspendFolder.Delete
'!!!!!!!!!!!!!!!!!!!!!!!!!!
End If
' .....
Next
Please keep in mind that this works with the first 20 MapiFolders and
the order does not seem to matter.
You see I'm using a up-counting loop but also tried with a for each
construct.
SuspendFolder is as I mentioned earlier the subfolder that should be
deleted and is of type MapiFolder!
Another strange thing is when I display that error message with
Err.Number I do always face a different error number.
Does anybody ever faced a similar problem?
Any suggestions, hints, tips,....?
Thanx in advance and best regards