Creating folders in Outlook 2010 - vba

I have a folder containing many subfolders on my desktop that I need to recreate in outlook 2010. The folders are empty and I have it as a template. There is something like 400 folders so I am trying to avoid manually creating every one of them in outlook.
The issue I have is that these folders aren't being put under my inbox, they are going to be created under a common mailbox accessible by my coworkers. We are using this for archiving purposes. Most of the codes I have found are for creating folders under your inbox.
How would I go about recreating the directory under this public mailbox? I have very little experience in VBA programming. I also have all the folder names in excel if that makes it any easier to accomplish this.
Thanks in advance for any help.

Well, I'd suggest starting from the Getting Started with VBA in Outlook 2010 article in MSDN to learn the basics. From the Outlook object model there is no difference where the folder is located. The Add method of the Folders class creates a new folder in the Folders collection.
You may use the Stores property of the Namespace class which returns a Stores collection object that represents all the Store objects in the current profile. Also the GetSharedDefaultFolder method of the Namespace class returns a Folder object that represents the specified default folder for the specified user.

Related

Export visual basic outlook project and add it to other outlook account

I created two macros in Outlook's VB and I want to pass them on to others where I work. Is it possible to do this without copying the code to each account individually? Is there a way to export my project (or my modules) and import it into another account so that the macros I wrote will be added automatically?
Another option for me is whether it can be done in a small program written in C# (i.e. Console Application) with the Outlook namespace.
If you're developing a solution that you intend to distribute to more than a few people, you should convert your VBA code into an Outlook COM or VSTO add-in or an Office add-in for Outlook. However, developing an add-in typically requires considerably more programming knowledge than creating a short macro. If your VBA project is relatively simple, and there aren't too many people that have to use it, you may want to distribute the code together with instructions to set it up.
The easiest solution is to right click on ThisOutlookSession and choose Export File. You'll need to do for each module (if any) in your Project.
Unlike other Microsoft Office programs, Outlook supports only one VBA project at a time. VBA macros are stored in a file that's named VbaProject.OTM. This file is a product storage file and isn't meant for distribution. Outlook doesn't provide a direct means to manage OTM files. Outlook VBA code wasn't designed to be deployed or distributed. It was designed solely to be a personal macro development environment. The project, Project1, is available and associated with the program at all times. It's not possible to add another project in the Visual Basic Editor.
Project1 is stored on your hard disk as VbaProject.otm in the following folder:
<Drive>:\Users\<LogonName>\AppData\Roaming\Microsoft\Outlook
If you want to begin a new VBA project, you could theoretically export all your existing modules and forms. But this is typically not a realistic approach. Instead, follow these steps:
Exit Outlook.
Locate your VbaProject.otm file in the indicated path.
Rename the file to something meaningful to you, such as VbaProject-testing.otm.
Restart Outlook.
Because Outlook can't find an existing project file, Visual Basic Editor starts with a new project. When you save changes to your project, Outlook creates a new VbaProject.otm file in the folder. If you want to switch between projects, add one more step to the previous procedure (as step 4):
Exit Outlook.
Locate your VbaProject.otm file.
Rename the file to something meaningful to you, such as VbaProject-testing.otm.
Restore the name the file that you now want to use as VbaProject.otm.
Restart Outlook.
If you want to move a VBA project from one computer to another, first determine where Outlook is storing the VbaProject.otm files on each computer. Then, copy the OTM file from one computer to the other, and make sure to put it into the correct folder. When you restart Outlook, the program will find the VbaProject.otm file and use it.
You may find the How to backup and save your Outlook VBA macros article helpful.

Programmatically set default column values based on folder in SharePoint Online

I'm working on enhancing metadata in our SharePoint online (O365) environment. Since a portion of my user base is used to foldering (explorer style), I've started using default column values to automatically set values on any files added to that specific folder (we have content organized categorically by folder currently). An example is our HR documents library - we have separate folders for recruiting, payroll, personnel files, etc. that automatically categorize files added to that folder with the same categories (recruiting, payroll, personnel, etc.). This supports both "search" and "click" users and makes adoption WAY easier while getting important metadata.
I want to implement this in a larger, more dynamic fashion, so manually setting default column values on each folder is not going to be scalable.
How can I reference the top level folder within the library (or even the current folder) for each newly added file and populate the "category" field for that new file with that folder name? I can do some very basic C# or Java code copy/paste, but bonus points for non-coding solutions =)
This problem can be solved through no coding.You can use the workflow to implement this by SharePoint Designer.
Create different view for different function team, and then use the view filter to show the document.
If you upload a file, use the workflow to set the metadata of the file. There are some known limitations: if you upload multiple files at the same time, the metadata for the file maybe does not work well; or if you upload a folder, the meta will not work for it and the file in the folder may not be set to right metadata.
I was actually able to use MS Flow to accomplish this in a pretty simple and straightforward fashion without managing custom views per team. The concept at a high level was:
(Trigger) When a new document is created in a folder in the library
Get the link of the parent folder of the newly added document
Create a variable (or just code it out in the Flow step) to parse out the name of the parent folder from the parent folder link (should be all text to the right of the last "/")
Set the category field as the variable
I'm sure that you could do the same right in a SharePoint designer workflow, but I prefer flow due to the visual aspect of it and being far easier to troubleshoot.

How to delete Search Folders

Is it possible to delete Search Folders in Outlook using VBA?
I'm trying to figure out, but I don't know how to do it.
My goal is to make a search folder as a temporary storage of my mails and delete it after accessing the emails inside the search folder. I already have the code for creating search folder. But what I want to do is delete the search folder.
I found a code in slipstick.com but my knowledge is not enough to understand the whole process of the program:
http://www.slipstick.com/developer/create-an-outlook-search-folder-using-vba/
Use the Delete method of the Folder class.

Outlook Quick Search Folder Structure by Name

Is there any easy way to quickly search for the name of a folder in Outlook's inbox folder structure?
I am talking about this:
I have to categorize emails into this folder structure as they arrive but 99% of the time is looking for the right folder...
We are running our own Exchange and I am using Outlook over rdp
http://i.stack.imgur.com/wZDKS.png
The Outlook object model doesn't provide any property of method for that.
You need to develop a VBA macro or add-in to ge the job done. For example, you can iterate over the folders structure to find the required one. The Folders property of the Folder class returns the Folders collection that represents all the folders contained in the specified Folder. So, you may walk down to the tree recursively.

VB - Any way to put 'Resources' items in a Resources subfolder?

I have a VB.NET 2010 project that contains a lot of resources (which I added via My Project --> Resources). And they work just fine.
But what I would like to do (if possible) is organize them by putting them in various subfolders.
For example... in the Solution Explorer, I right-click on the 'Resources' folder and choose 'Add new folder' (which adds a subfolder inside the Resources folder). But when I try to drag one of the Resources items into the subfolder, it doesn't work (it throws an error message stating "Resource could not be loaded because the file to which it is linked could not be found").
So... I was wondering if there is any workaround for this? Since I have so many resources in this project, it would really be helpful if I could have about a dozen subfolders INSIDE the Resources folder, and then put my resources items inside those subfolders. FYI... this is strictly for my own organizational needs while coding the project, so I could care less how the resources items and folders are arranged at compile time.
Thanks!
Put them in the folders first, then add them as resources. If the files you pick are already in the project's Resources folder, they won't be recopied.