Powershell Script to Create Outlook 2019 Personal Folder - windows

Currently users have their own inbox folder and due to corporate policy emails will automatically be deleted after a set period of time.
Some emails however users would like to be able to keep for reference.
In order to accomplish allowing users to keep their importasnt emails; a personal folder file .pst needs to be created. The deletion policy will on affect the exchange profile folder that they currently use. This special personal folder should not be touched by the corporate system.
I need to be able to run a powershell script to automatically create this folder for the user (logged in user on the computer) and assign it in outlook 2019 for use, the user will then copy their specific emails into that personal folder. If I can't do it for the current logged in user - then by a collection of usernames and put in their one drive folder ??
Anyone with knowledge of how to or code to do this, I would appreciate your help - while I can code - I'am not a Powershell Guru so specifics and functions that experts might know exactly - I do not know, so please in your answer provide good guidance.
I am using windows 10 .1909 and the powershell version that ships with it.

The Outlook object model provides the AddStoreEx method which adds a Personal Folders file (.pst) in the specified format to the current profile.
Sub CreateUnicodePST()
Dim myNameSpace As Outlook.NameSpace
Set myNameSpace = Application.GetNamespace("MAPI")
myNameSpace.AddStoreEx "c:\" & myNameSpace.CurrentUser & "\.pst",olStoreUnicode
End Sub
After creating additional storage in the Outlook profile users can move items for keeping them locally. Or you may consider creating a VBA script or COM add-in for doing that programmatically. See Walkthrough: Create your first VSTO Add-in for Outlook for getting started quickly.

Related

Outlook web addin save the mail and lauch a program

I had a VSTO in Outlook which saves the the selected email into a Temp folder and launchs then an exe to handle the mail.
Now, we want to create an addin in Outlook web app. Is there a way to save the selected email and reuse out exe ? how to launch an exe loccaly from web addin ?
Thanks
Web addins have no access to the local file system and cannot launch executables.
The best you can do is let the user download the file. If your app is registered to handle file extension of the file you provide, the user can then launch the app.
That is not possible. For security reasons Office web add-ins don't have access to the local file system, but you may consider using all standard mechanisms for web applications like web storage and etc. So, it is not possible to run any executable files on the local system for security reasons.
Office web add-ins are run under the context of currently selected item in Outlook. The Office JavaScript API doesn't provide any method for saving items on the disk (again, disk IO operations for accessing the local filesystem is not available for security reasons).
You can post or vote for an existing feature request on Tech Community where they are considered when the Office dev team goes through the planning process.

How to create Global Address List folder in Outlook programmatically?

I have Outlook plugin (written with Visual C++) which syncs contacts with DAV server (which acts as a replacement to Exchange). Personal contacts are fine but I don't know how to mimic the behavior of Global Address List (GAL).
Ideally, I want to create GAL folder the user will be able to search just like how it happens when Outlook is connected to Exchange. Is it possible at all? Perhaps, it's not possible with Outlook Object Model but still possible with MAPI? Can anybody point me in the right direction on how to start?
I need to support Outlook 2007+ but supporting only the newest versions (for this particular functionality) is an option, too.
Originally, I just synced the entire GAL folder and made it read-only so that Outlook stored the local copy of the entire GAL. This does not work well when the GAL size stretches to thousands of records.
You cannot do that - the address book provider can tell Outlook to only allow searches and never display the actual contents of the container.
You cannot do that with an Outlook folder unless you create your own MAPI store provider: then you can return any data you want depending on what the user is doing.

How can I add folder to outlook without permission to root folder

I am trying to add shared folder to MS Outlook 2010. When I do this with
file=>open=>open use's folder there is no issue. The folder appears but it is very uncomfortable to use mailbox like that. The main issue is that when I added additional mailbox I cannot access it. I get message
Cannot display the folder. Microsoft Outlook cannot access the specified folder location. The operation failed. An object cannot be found.
I think that I have not permission to the root folder of mailbox and this is why I cannot get to the folder(which is actually mailbox). unfortunately I cannot check if I have the permission.
Is there any way to add the folder permanently?
You will need to be an owner with Full Mailbox access to add that Mailbox to an existing or new Outlook profile (this is the most "permanent" way). Otherwise the owner of that Mailbox will need to use the Delegate options to share one or more of their default Outlook folders with you (sharing other non-default folders aren't possible). Once you access a shared folder it should be added to the Navigation module for that folder type so you can access it quickly later.
If the owner doesn't share as Full Mailbox or via Delegates, then you don't have access to any folders and cannot view them.

How to create a undeletable folder in an online mailbox in Exchange

I have a customer hosted in Exchange online, they'd like to create some folders that are undeletable and unmovable by their users, they do want users to be able to copy items into and out of the folders, the folders cannot be shared. I've been casting about for a MAPI property that would do the trick but PR_ACCESS is read-only/computed. I know I can create an add-in that prevents folders from move/delete but the solution needs to work in OWA as well as Outlook. Any Ideas?
Can't do that - all folders in the primary mailbox are read/write. If you open a delegate store, you can set the folder ACL.

Adding files to all users 'My Documents' folders in Windows

I am creating an installer (using Inno Setup) for a windows application. The app has initial documents that I need to store in the users 'My Documents' folder.
Here is the issue, I install it as an Admin, but there may be one or many non admin users on that machine. How can i add that same folder to all the possible current (and future user's) My Documents folder?
Here is what i have tried so far-
1) I could try to pick up all usernames - This however, wont work for future user creations :(
2) I have tried to add it to the systems %allusersprofile%\Documents folder. It does not get reflected to individual My Documents folders.
I believe there should be a way, but have been unable to find a clean solution off the internet till now. Can anyone direct me towards the right path?
Mucho Thanks!
There isn't really a construct for this in Windows. You have a few options:
Put the document in some common place (like %allusersprofile%\Documents, or %program files%\yourCompany\yourApp\documents) and create a start menu link/icon that points to either the folder with the documents or the document itself.
Put the document into the Default User documents folder. When a new user is created, their profile is setup to mirror that of the default user. This doesn't help you with current users, but it does help you for users who haven't been created (logged on)
I'd go with option 1 because it's relatively standard and its what your average user is going to expect.
Look at Inno Setup Shell Folder Constants : {commondocs}

Resources