Error copying a public Contact folder within Outlook 2000 SR1 
Author Message
 Error copying a public Contact folder within Outlook 2000 SR1

Issue:  Error copying  a public Contacts folder within Outlook 2000 SR1

Error Message:  Can't copy folder.  A top-level folder can't be copied to
one of its subfolders.  Or, you may not have appropriate permissions for the
folder.  To check your permissions for the folder, right-click the folder,
and then click Properties on the shortcut menu.

Evaulation:  The CopyTo function with Contact Items contents within Outlook
model appears to have and issue completing the copy procedure.  This error
seems to have cropped up since install of Exchange SP4.

The copy procedure appears to be working, progress is shown up to 100%...but
then when it trys to complete, the error message is displayed.

It happens for each user and for the actual owner of the public folder.

It happens whether I try via code (i.e. fldrContacts.CopyTo) or manually try
to copy manually.

This processed has worked for well over 18 months, with no glitches...

Has any one seen this issue?

Additional Info:

Exchange Server specs:
OS: Windows NT 4.0, SP6a
XCHG: Exchange 5.5 SP4

User system specs:
OS: Winnt Workstation SP6a or Win2K Professional SP2
Outlook version: 9.0.0.4604

Thanks in advance.

Shawn Liggett, MCSE
Systems Analyst



Tue, 20 Jul 2004 04:26:47 GMT  
 Error copying a public Contact folder within Outlook 2000 SR1
Show the code you are using. I'm not having problems with Outlook 2000
SR1A and Exchange 5.5 SP4.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Issue:  Error copying  a public Contacts folder within Outlook 2000
SR1

> Error Message:  Can't copy folder.  A top-level folder can't be
copied to
> one of its subfolders.  Or, you may not have appropriate permissions
for the
> folder.  To check your permissions for the folder, right-click the
folder,
> and then click Properties on the shortcut menu.

> Evaulation:  The CopyTo function with Contact Items contents within
Outlook
> model appears to have and issue completing the copy procedure.  This
error
> seems to have cropped up since install of Exchange SP4.

> The copy procedure appears to be working, progress is shown up to
100%...but
> then when it trys to complete, the error message is displayed.

> It happens for each user and for the actual owner of the public
folder.

> It happens whether I try via code (i.e. fldrContacts.CopyTo) or
manually try
> to copy manually.

> This processed has worked for well over 18 months, with no
glitches...

> Has any one seen this issue?

> Additional Info:

> Exchange Server specs:
> OS: Windows NT 4.0, SP6a
> XCHG: Exchange 5.5 SP4

> User system specs:
> OS: Winnt Workstation SP6a or Win2K Professional SP2
> Outlook version: 9.0.0.4604

> Thanks in advance.

> Shawn Liggett, MCSE
> Systems Analyst



Wed, 21 Jul 2004 00:49:41 GMT  
 Error copying a public Contact folder within Outlook 2000 SR1
Function CreateLocalRosterAddressFolder()

    Dim lFolder As Outlook.MAPIFolder
    Dim ViewFolder As Outlook.MAPIFolder
    Dim perFolder As Outlook.MAPIFolder
    Dim pFolder As Outlook.MAPIFolder
    Dim lRoster As Outlook.MAPIFolder
    Dim myItems As Outlook.Items
    Dim AllItems As Outlook.Items
    Dim URItems As Outlook.Items
    Dim Response As VbMsgBoxResult
    Dim ALists As Outlook.AddressLists
    Dim AList As Outlook.AddressList
    Dim myItem As Variant

    On Error Resume Next

    For Each lFolder In ThisOutlookSession.Session.Folders

        If InStr(1, lFolder.Name, "Personal Folders", vbTextCompare) <> 0
Then

            Set perFolder = ThisOutlookSession.Session.Folders("Personal
Folders")

            If perFolder.Name <> "Personal Folders" Then

                perFolder.Name = "Personal Folders"

            End If

        End If
    Next

    If perFolder Is Nothing Then
        GoTo Lastline
    End If

    Set lRoster = perFolder.Folders("Contacts").Folders("Roster Addresses
Local")

    On Error GoTo err_Create

    If lRoster Is Nothing Then

        Response = MsgBox("Outlook Enhancements must now create a local copy
of Roster Addresses.", vbInformation, "Outlook Enhancement Configuration")

        If Response <> vbOK Then
            GoTo Lastline
        End If

        'MsgBox "Select the correct Public Roster Addresses Listing.",
vbInformation, "Select List"

        Set pFolder = ThisOutlookSession.Session.Folders("Public
Folders").Folders("All Public Folders").Folders("Roster Addresses")

        If pFolder Is Nothing Then
            GoTo Lastline
        End If

        With frmSynchronize
            .Caption = "Please wait.."
            .lblStatus.Caption = "Creating Local Roster Addresses..":
DoEvents
            .progStatus.Visible = False
            .Show
        End With

        frmSynchronize.lblStatus.Caption = "Copying folder...": DoEvents

        'Copy Roster addresses to local contacts folder

  ' *** Ken...This is the actual method that errors when it completes copy
process.  Same function is perform if you manually drag/drop/copy folder,
with same error.

        Set lFolder = pFolder.CopyTo(perFolder.Folders("Contacts"))

         'Mark items as read in this folder

        Set AllItems = lFolder.Items
        Set URItems = AllItems.Restrict("[UnRead] = True")

        If URItems.Count >= 1 Then
            Response = MsgBox("Would you like to mark all contact items as
read?", vbYesNo, "Mark Items as Read")
            If Response <> vbYes Then
                GoTo SkipMarkAsRead
            End If
        End If

        frmSynchronize.lblStatus.Caption = "Marking Items as Read...":
DoEvents

MarkAsUnread:

        Set URItems = AllItems.Restrict("[UnRead] = True")

        frmSynchronize.lblStatus.Caption = "Marking Items as Read (" &
URItems.Count & ")"

        If URItems.Count > 0 Then

            Set myItem = URItems.GetFirst

            If Not myItem Is Nothing Then
                myItem.UnRead = False
                DoEvents
            End If

            GoTo MarkAsUnread

        End If

SkipMarkAsRead:

        frmSynchronize.lblStatus.Caption = "Renaming Folder..": DoEvents

        lFolder.Name = "Roster Addresses Local"

        frmSynchronize.lblStatus.Caption = "Configuring Contacts Web
View..": DoEvents

        Set ViewFolder = ThisOutlookSession.Session.Folders("Personal
Folders").Folders("Contacts")

        'Set Web View for local contacts folder
        ViewFolder.WebViewOn = True
        ViewFolder.WebViewURL = "C:\ECAR Program
files\Outlook\HTML\Contacts.htm"

    Else

        Set lFolder = perFolder.Folders("Contacts").Folders("Roster
Addresses Local")
        Set ViewFolder = perFolder.Folders("Contacts")
        'Set Web View for local contacts folder
        ViewFolder.WebViewOn = True
        ViewFolder.WebViewURL = "file:C:\ECAR Program
files\Outlook\HTML\Contacts.htm"

    End If

Lastline:
    On Error Resume Next

    Set lFolder = Nothing
    Set pFolder = Nothing
    Set myItems = Nothing
    Set perFolder = Nothing
    Set ViewFolder = Nothing
    Set ALists = Nothing
    Set AList = Nothing

    Unload frmSynchronize

    Exit Function

err_Create:

    MsgBox Err.Description, vbCritical, "Error " & Err.Number

    Resume Lastline

End Function



Mon, 26 Jul 2004 07:03:11 GMT  
 Error copying a public Contact folder within Outlook 2000 SR1
Is perFolder.Folders("Contacts") a valid folder? Is it in the same
store as the original, that would be required. Why use
ThisOutlookSession, instead of an Outlook.Application object, such as:
    Set objOL = CreateObject("Outlook.Application")

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Function CreateLocalRosterAddressFolder()

>     Dim lFolder As Outlook.MAPIFolder
>     Dim ViewFolder As Outlook.MAPIFolder
>     Dim perFolder As Outlook.MAPIFolder
>     Dim pFolder As Outlook.MAPIFolder
>     Dim lRoster As Outlook.MAPIFolder
>     Dim myItems As Outlook.Items
>     Dim AllItems As Outlook.Items
>     Dim URItems As Outlook.Items
>     Dim Response As VbMsgBoxResult
>     Dim ALists As Outlook.AddressLists
>     Dim AList As Outlook.AddressList
>     Dim myItem As Variant

>     On Error Resume Next

>     For Each lFolder In ThisOutlookSession.Session.Folders

>         If InStr(1, lFolder.Name, "Personal Folders", vbTextCompare)
<> 0
> Then

>             Set perFolder =

ThisOutlookSession.Session.Folders("Personal

- Show quoted text -

Quote:
> Folders")

>             If perFolder.Name <> "Personal Folders" Then

>                 perFolder.Name = "Personal Folders"

>             End If

>         End If
>     Next

>     If perFolder Is Nothing Then
>         GoTo Lastline
>     End If

>     Set lRoster = perFolder.Folders("Contacts").Folders("Roster
Addresses
> Local")

>     On Error GoTo err_Create

>     If lRoster Is Nothing Then

>         Response = MsgBox("Outlook Enhancements must now create a
local copy
> of Roster Addresses.", vbInformation, "Outlook Enhancement
Configuration")

>         If Response <> vbOK Then
>             GoTo Lastline
>         End If

>         'MsgBox "Select the correct Public Roster Addresses
Listing.",
> vbInformation, "Select List"

>         Set pFolder = ThisOutlookSession.Session.Folders("Public
> Folders").Folders("All Public Folders").Folders("Roster Addresses")

>         If pFolder Is Nothing Then
>             GoTo Lastline
>         End If

>         With frmSynchronize
>             .Caption = "Please wait.."
>             .lblStatus.Caption = "Creating Local Roster
Addresses..":
> DoEvents
>             .progStatus.Visible = False
>             .Show
>         End With

>         frmSynchronize.lblStatus.Caption = "Copying folder...":
DoEvents

>         'Copy Roster addresses to local contacts folder

>   ' *** Ken...This is the actual method that errors when it
completes copy
> process.  Same function is perform if you manually drag/drop/copy
folder,
> with same error.

>         Set lFolder = pFolder.CopyTo(perFolder.Folders("Contacts"))

>          'Mark items as read in this folder

>         Set AllItems = lFolder.Items
>         Set URItems = AllItems.Restrict("[UnRead] = True")

>         If URItems.Count >= 1 Then
>             Response = MsgBox("Would you like to mark all contact
items as
> read?", vbYesNo, "Mark Items as Read")
>             If Response <> vbYes Then
>                 GoTo SkipMarkAsRead
>             End If
>         End If

>         frmSynchronize.lblStatus.Caption = "Marking Items as
Read...":
> DoEvents

> MarkAsUnread:

>         Set URItems = AllItems.Restrict("[UnRead] = True")

>         frmSynchronize.lblStatus.Caption = "Marking Items as Read ("
&
> URItems.Count & ")"

>         If URItems.Count > 0 Then

>             Set myItem = URItems.GetFirst

>             If Not myItem Is Nothing Then
>                 myItem.UnRead = False
>                 DoEvents
>             End If

>             GoTo MarkAsUnread

>         End If

> SkipMarkAsRead:

>         frmSynchronize.lblStatus.Caption = "Renaming Folder..":
DoEvents

>         lFolder.Name = "Roster Addresses Local"

>         frmSynchronize.lblStatus.Caption = "Configuring Contacts Web
> View..": DoEvents

>         Set ViewFolder =

ThisOutlookSession.Session.Folders("Personal

- Show quoted text -

Quote:
> Folders").Folders("Contacts")

>         'Set Web View for local contacts folder
>         ViewFolder.WebViewOn = True
>         ViewFolder.WebViewURL = "C:\ECAR Program
> files\Outlook\HTML\Contacts.htm"

>     Else

>         Set lFolder = perFolder.Folders("Contacts").Folders("Roster
> Addresses Local")
>         Set ViewFolder = perFolder.Folders("Contacts")
>         'Set Web View for local contacts folder
>         ViewFolder.WebViewOn = True
>         ViewFolder.WebViewURL = "file:C:\ECAR Program
> files\Outlook\HTML\Contacts.htm"

>     End If

> Lastline:
>     On Error Resume Next

>     Set lFolder = Nothing
>     Set pFolder = Nothing
>     Set myItems = Nothing
>     Set perFolder = Nothing
>     Set ViewFolder = Nothing
>     Set ALists = Nothing
>     Set AList = Nothing

>     Unload frmSynchronize

>     Exit Function

> err_Create:

>     MsgBox Err.Description, vbCritical, "Error " & Err.Number

>     Resume Lastline

> End Function



Tue, 27 Jul 2004 00:58:08 GMT  
 Error copying a public Contact folder within Outlook 2000 SR1
Ken,

Yes, perFolder.Folders("Contacts") is a valid folder.  This is the users
Personal Folder default Contact folder.  The Contact Items folder being
copied is a public folder.

ThisOutlookSession is being used because this code is being run during the
user's current Outlook session (i.e. VBAProject.OTM).  The object is already
created...why create another???

Remember what I aslo mentioned, the issue also happens if I manually try to
copy this folder.  I wonder if this public folder has been somehow
'corrupted'...a new public folder created appears to work without any
issue???

Shawn Liggett, MCSE



Tue, 27 Jul 2004 03:44:22 GMT  
 Error copying a public Contact folder within Outlook 2000 SR1
If it works with one PF and not another then it's either a corrupted
folder (check with the Exchange tools) or you aren't getting the
correct folder object in your code even if the name is a valid folder
name. Judicious use of the MsgBox function and debugging will tell you
that.

If the code is being run in the ThisOutlookSession class module then
just use Application instead of CreateObject. ThisOutlookSession has
an inherent Application object.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm


Quote:
> Ken,

> Yes, perFolder.Folders("Contacts") is a valid folder.  This is the
users
> Personal Folder default Contact folder.  The Contact Items folder
being
> copied is a public folder.

> ThisOutlookSession is being used because this code is being run
during the
> user's current Outlook session (i.e. VBAProject.OTM).  The object is
already
> created...why create another???

> Remember what I aslo mentioned, the issue also happens if I manually
try to
> copy this folder.  I wonder if this public folder has been somehow
> 'corrupted'...a new public folder created appears to work without
any
> issue???

> Shawn Liggett, MCSE



Tue, 27 Jul 2004 05:49:05 GMT  
 Error copying a public Contact folder within Outlook 2000 SR1
I have created a new public Contact Items folder and copied over all contact
items from 'corrupted' public folder.  After resetting all permissions, etc.
on new folder, looks like I'm back in business with desired functionality.
Something in the public info store with this object container must have got
'hosed'.  Not sure exactly when issue actually was introduced, but I guess
it doesn't matter now...it's fixed!!! :-)

Thanks for words of wisdom.

Shawn Liggett, MCSE



Tue, 27 Jul 2004 07:10:13 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Contact Database within Outlook 2000?

2. Enable a Public folder (contacts) for Outlook address Book

3. Outlook 2000 & Contacts folder email address

4. Public Folder in Outlook 2000

5. Accessing Outlook Contacts in Public Folder

6. my own popup in folder contact with VBA and Outlook 2000

7. outlook 2000 contact folder updating using vb

8. Public Folder Contact folders.

9. Syncronize in programmatic way, the folder Contact with the public folder

10. Prob : Adding contacts for Outlook 2000 and Outlook 97

11. Outlook Public Folder Error

12. Programs folder (Outlook 2000 or Outlook Express

 

 
Powered by phpBB® Forum Software