Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, How can I copy and paste contact items from a Outlook public folder to a different public folder?

 

I'm getting the contact items like this: (thanks again mark007 ;) )

 

Sub Main() 
Try 
       Dim objOutlook As Outlook._Application 
       objOutlook = New Outlook.Application 
       Dim objNS As Outlook._NameSpace = objOutlook.Session 
       Dim objFolder As Outlook.MAPIFolder = _ 
           objNS.Folders.Item("Public Folders") 
       objFolder = objFolder.Folders.Item("All Public Folders") 
       objFolder = objFolder.Folders.Item("Contact Mgmt") 
       objFolder = objFolder.Folders.Item("RC Contacts") 


       Dim objItems As Object = objFolder.Items 
       Dim objItem As Object 
       For Each objItem In objItems 
           if System.Convert.ToString(objItem.Categories).IndexOf("Staff")>-1 then
               Console.WriteLine(objItem.Email1Address & vbCrLf) 
           End if
       Next 


Catch ex As Exception 
Console.Writeline(ex.Message) 
End Try 

   End Sub 

Posted

Assuming the Contact you wish to copy is objItem and the detination folder is objFolder you would use:

 

Dim objItem2 as Object
objItem2=objItem.Copy()
objItem2.Move(objFolder)

 

Hope that helps.

 

:)

Please check the Knowledge Base before you post.

"Computers are useless. They can only give you answers." - Pablo Picasso

The Code Net

Posted
would that leave the copied items in the original folder or move it to the new location? I want to keep the items in the original folder as well, ie. backup.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...