Re: Programmatically adding contacts to a 'specific' folder?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Ken Slovak (kenslovak_at_mvps.org)
Date: 02/02/05


Date: Wed, 2 Feb 2005 09:54:02 -0500

See the objFolder.Items.Add method where objFolder is the desired folder.

-- 
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm
"John Wiese (MS)" <jwiese@microsoft.com> wrote in message 
news:%23My9FPTCFHA.3416@TK2MSFTNGP09.phx.gbl...
>I have a need to create folders under my main Contacts folder, this I have
> done without a problem.  What is causing me issues is adding my new 
> contacts
> to these specific folders.  I can not find a way to add the new contact to
> my specific folder.  Has anyone tried this, or know of a way to accomplish
> it...here is what I am doing right now:
>
> Outlook.ContactItem objContact = (Outlook.ContactItem)
> m_OutlookApp.CreateItem(Outlook.OlItemType.olContactItem);
>
>
> Outlook.MAPIFolder objContactFolder =
> m_OutlookNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts);
>
> objContactFolder.Folders.Add("CoWorkers",
> Outlook.OlDefaultFolders.olFolderContacts);
>
>
>
> objContact.BusinessTelephoneNumber = workPhone.ToString();
>
> objContact.MobileTelephoneNumber = cellPhone.ToString();
>
> objContact.HomeTelephoneNumber = homePhone.ToString();
>
> objContact.FullName = fullName.ToString();
>
> objContact.FirstName = fullName.Substring(0, fullName.IndexOf("
> " ) ).ToString();
>
> objContact.LastName = fullName.Substring(fullName.IndexOf("
> " ) ).ToString();
>
> objContact.Email1Address = alias + "@Microsoft.com";
>
> objContact.IMAddress = externalIM.ToString();
>
> objContact.ManagerName = manager.ToString();
>
> objContact.Department = workgroup.ToString();
>
> objContact.CompanyName = "Company";
>
> objContact.Categories = "Group1, Group2";
>
>
>
> objContact.Save();
>
>
>
> So I need some way to make the Save() put the contact in the folder I just
> created and not in the root Contacts folder.
>
>
>
> Thanks,
>
>
>
> John Wiese
>
>
>
> 


Relevant Pages

  • Re: Outlook displays two identical Personal Folders
    ... Create a new mail profile and point it to reuse your current active .pst ... Milly Staples [MVP - Outlook] ... ||| Folder in the folder list. ...
    (microsoft.public.outlook.installation)
  • Re: WTF is right with OE? and how to remove it. LONG!
    ... > you an SASE for a photo of those instructions. ... The instructions say Windows 2000, this works for XP as well just substitute ... the Windows folder for the Winnt folder used in the instructions. ... Outlook Express 5.x and 6.0 on a computer that is running Microsoft Windows ...
    (news.software.readers)
  • Re: archive bit not set on mail folders?
    ... Because of this tendency of attachments to infect, Microsoft has now set OE to block all attachments. ... Cannot Open E-Mail Attachments in Outlook Express After You Install SP1 ... If you choose to adjust OE to allow attachments, make sure you save the attachment to disk first and then scan it with your antivirus software. ... When a message is deleted, moved or marked as read in an OE message file, then wasted space is generated in that file, and the folder must be compacted to remove that wasted space. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: msoe.dll
    ... Double-click to expand the HKEY_LOCAL_MACHINE folder, ... click to select the Microsoft Outlook ... Don't open attachments. ... > attachment to disk first and then scan it with your antivirus software. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: lost ALL e-mail, not folders !
    ... a friend of mine has installed Windows XP on ... Because of this tendency of attachments to infect, Microsoft has now set OE to block all attachments. ... Cannot Open E-Mail Attachments in Outlook Express After You Install SP1 ... When a message is deleted, moved or marked as read in an OE message file, then wasted space is generated in that file, and the folder must be compacted to remove that wasted space. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)