How to detect "This computer only" flag in Outlook folder names in VSTO addin? - vsto

Starting from Outlook 2013 and newer, Outlook may sometimes (in case of .OST files) append "(This computer only)" suffix to folder names. In other cases (.PST files) this does not happen. So, depending on particular circumstances a folder name can be "Some folder" or "Some folder (This computer only)" or "Some folder (who knows what else)" for localized versions of Outlook.
Is there any way to get the folder name without this suffix (so that I'd always get, let's say, "Some folder" regardless of whether this suffix is present in the folder name or not? Currently I don't see any property in Outlook.Folder object which would return me that short name.
I can think of a workaround like getting the default Contacts folder name, checking if it ends with "(something)" and then stripping "(something)" off folder names but it does not seem an elegant solution for me.
Another approach could be creating a temp folder and checking if its name is different from the one I provided. If they are different, that difference is the suffix. However, creating/deleting a folder just for that doesn't look elegant either.
In MFCMapi tool, I also can't find "Contacts" anywhere in the MAPI properties of the folder named "Contacts (This computer only)" so it doesn't seem to be just Outlook OOM limitation.
It it true that there is no way to get the folder name without that suffix programmatically and I should rely on my (ugly) workarounds only?

Do not rely on the folder names. Besides having the "(This computer only)" suffix for the IMAP4 stores, the names can be localized.
Always use Namespace.GetDefaultFolder and Store.GetDefaultFolder.

Related

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.

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.

Application Working Directory (VB.NET)

I am linking few excel and word files with my application. There is a predefined folder structure that holds all these files. i.e.
Base\Engineering\A.xlsx
Base\Sales\B.xlsx
and so on.
Now I want to link the "Base" folder with my application.
My current stupid solution is, to ask user to browse to the "Base" folder every time the application loads.
What is the most efficient way to do this?
In the end I want to create an installer for my application. I
wish to use Windows "Program Files" folder to host my folder
structure. This way users do not have to search for the "Base"
folder. How do I do this?
I am new to VB.NET.
You want the All Users Application Data folder:
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
There is also a per-User Application Data folder that you can reference. Which you need depends on what you're doing.

.Net - Find all Networked Computer names and their shared folders

I'm wanting to find all the names of the computers that are currently on the same network. Once I have the names, I want to see if a shared directory named Shared\NetworkFiles exists. *Edited and added - I might not know the actual network name itself to scan all the computers under a specific network name.
For instance: one working path is \\EQIZLOCAL-PC\Shared\NetworkFiles
I may have several other computers on the network as well that I'm not 100% sure what their names are that may have the same directory that exists and I need to be able to return a list of computer names that do have that path available.
Long story short... I just need to be able to
get all the names of the computers on the network
while getting the names check to see if the folder paths actually exist and add them to a listbox or something and i can handle the rest.
Apparently, you can use Imports System.DirectoryServices
There's example code on VB.NET List all Computers in Network/Workgroup
That should answer at least part of your question.

WiX: Rename a folder during installation

I have very complex folders structure to install (dozens of folders/subfolders).
I have prepared the whole structure with heat.exe, but some folder names have "template" names instead of the real ones.
Is it possible using WiX to rename the "templated" folders during the installation?
Say I have
DirA
DirTemplate1
DirC
DirD
DirTemplate2
DirE
I can get real names for DirTemplate1 and DirTemplate2 via UI only.
Can I rename the folders after they are copied to the target?
I suppose that you familiar with WiX. And explain a few variants how it could be done.
In directory table you named needed folders with CAPITAL letters, for example DIRTEMPLATE1. Then create dialog window and set this Directory with new value. During installation directory will be created with new folder name.
(Not recommended) Create custom action which will rename needed directories at the end of installation. Not recommended because uninstallation won't delete new folders, the Repair won't work as should.
I realized that this is simply not possible to do in a right way, it contradicts the installation ideology. I would accept such answer and start thinking on a different solution. Not all problems have a solution.