listpoy.blogg.se

How do i create a new folder in my outlook mail
How do i create a new folder in my outlook mail










how do i create a new folder in my outlook mail
  1. #How do i create a new folder in my outlook mail how to#
  2. #How do i create a new folder in my outlook mail code#

If Not IsNothing(folderInbox) Then Marshal.ReleaseComObject(folderInbox) If Not IsNothing(inboxFolders) Then Marshal.ReleaseComObject(inboxFolders) If Not IsNothing(subfolderInbox) Then Marshal.ReleaseComObject(subfolderInbox) If (ex.ErrorCode = -2147352567) Then Cannot create the folder.

how do i create a new folder in my outlook mail

SubfolderInbox = inboxFolders.Add("InboxSubfolder", Private Sub CreateInboxSubFolder(Application As Outlook.Application)ĭim mapiNameSpace As Outlook.NameSpace = Application.GetNamespace("MAPI")ĭim folderInbox As Outlook.MAPIFolder = mapiNameSpace.GetDefaultFolder(ĭim inboxFolders As Outlook.Folders = folderInbox.Foldersĭim subfolderInbox As Outlook.MAPIFolder = Nothing ReleaseComObject (folderInbox ) if ( nameSpace != null ) Marshal. ReleaseComObject (inboxFolders ) if (folderInbox != null ) Marshal. ReleaseComObject (subfolderInbox ) if (inboxFolders != null ) Marshal. Application OutlookApp ) if (subfolderInbox != null ) Marshal. So, let's get to work!Ĭ# and Add-in Express: private void CreateInboxSubFolder (Outlook. In Add-in Express based add-ins you can retrieve it using the OutlookApp property of the add-in module and in VSTO based add-ins please use the Application property of the add-in class.

#How do i create a new folder in my outlook mail code#

To get the code running you need to pass an instance of the Outlook Application class to the CreateInboxSubfolder method. The sample code you see below creates a subfolder in the Inbox folder. Say, if you want to create a subfolder with the parent folder type, you can omit the second parameter. The following values are possible for the second parameter: olFolderCalendar, olFolderContacts, olFolderDrafts, olFolderInbox, olFolderJournal, olFolderNotes and olFolderTasks. If the new folder type is not specified, it will default to the type of the folder in which it is created. The second parameter accepts the OlDefaultFolders enumeration that indicates the type of folder you want to create. The first parameter of the Add function accepts a string which contains the display name of the new folder. And this is exactly what we need to implement the required functionality. You can get an instance of the Folders class using the Folders property of the Folder class in Outlook. As you have probably noticed, the Outlook Object Model provides the Add function of the Folders class.

#How do i create a new folder in my outlook mail how to#

Today I will show you how to create a new folder in Outlook.












How do i create a new folder in my outlook mail